Adjust minor details about Jinja processing

pull/64/head
Tim Byrne 7 years ago
parent 3a87fe311a
commit c053481c21
No known key found for this signature in database
GPG Key ID: 14DB4FC2465A4B12
  1. 57
      yadm.1

@ -91,9 +91,9 @@ Instead use the
command (see below).
.TP
.B alt
Create symbolic links and process jinja templates for any managed files matching the naming rules describe
in the ALTERNATES section.
It is usually unnecessary to run this command, as
Create symbolic links and process Jinja templates for any managed files
matching the naming rules described in the ALTERNATES and JINJA sections. It is
usually unnecessary to run this command, as
.B yadm
automatically processes alternates by default.
This automatic behavior can be disabled by setting the configuration
@ -490,42 +490,47 @@ using the configuration options
and
.BR local.user .
If
.BR envtpl
(
.BR pip\ install\ envtpl
) is available, you can also create
.B jinja
templates (http://jinja.pocoo.org/) which will transformed into real files.
.SH JINJA
If the
.B envtpl
command is available,
.B Jinja
templates will also be processed to create or overwrite real files.
.B yadm
will treat files ending in
##yadm_tmpl
##yadm_tmpl
as jinja templates. During processing, the following variables are
set according to the above rules:
as Jinja templates. During processing, the following variables are set
according to the rules explained in the ALTERNATES section:
YADM_CLASS
YADM_OS
YADM_HOSTNAME
YADM_USER
YADM_CLASS
YADM_OS
YADM_HOSTNAME
YADM_USER
E.g. a file 'whatever##yadm_tmpl' with the following content
For example, a file named
.I whatever##yadm_tmpl
with the following content
{% if YADM_USER == 'harvey' -%}
config={{YADM_CLASS}}-{{ YADM_OS }}
{% else -%}
config=dev-whatever
{% endif -%}
{% if YADM_USER == 'harvey' -%}
config={{YADM_CLASS}}-{{ YADM_OS }}
{% else -%}
config=dev-whatever
{% endif -%}
would output a file with the follwing content, if the username would be 'harvey'
would output a file named
.I whatever
with the following content if the user is "harvey":
config=work-Linux
config=work-Linux
and the following otherwise:
config=dev-whatever
config=dev-whatever
See http://jinja.pocoo.org/ for an overview of
.BR Jinja .
.SH ENCRYPTION
It can be useful to manage confidential files, like SSH or GPG keys, across

Loading…
Cancel
Save