Adjust minor details about Jinja processing
This commit is contained in:
parent
3a87fe311a
commit
c053481c21
1 changed files with 31 additions and 26 deletions
57
yadm.1
57
yadm.1
|
@ -91,9 +91,9 @@ Instead use the
|
||||||
command (see below).
|
command (see below).
|
||||||
.TP
|
.TP
|
||||||
.B alt
|
.B alt
|
||||||
Create symbolic links and process jinja templates for any managed files matching the naming rules describe
|
Create symbolic links and process Jinja templates for any managed files
|
||||||
in the ALTERNATES section.
|
matching the naming rules described in the ALTERNATES and JINJA sections. It is
|
||||||
It is usually unnecessary to run this command, as
|
usually unnecessary to run this command, as
|
||||||
.B yadm
|
.B yadm
|
||||||
automatically processes alternates by default.
|
automatically processes alternates by default.
|
||||||
This automatic behavior can be disabled by setting the configuration
|
This automatic behavior can be disabled by setting the configuration
|
||||||
|
@ -490,42 +490,47 @@ using the configuration options
|
||||||
and
|
and
|
||||||
.BR local.user .
|
.BR local.user .
|
||||||
|
|
||||||
If
|
.SH JINJA
|
||||||
.BR envtpl
|
If the
|
||||||
(
|
.B envtpl
|
||||||
.BR pip\ install\ envtpl
|
command is available,
|
||||||
) is available, you can also create
|
.B Jinja
|
||||||
.B jinja
|
templates will also be processed to create or overwrite real files.
|
||||||
templates (http://jinja.pocoo.org/) which will transformed into real files.
|
|
||||||
.B yadm
|
.B yadm
|
||||||
will treat files ending in
|
will treat files ending in
|
||||||
|
|
||||||
##yadm_tmpl
|
##yadm_tmpl
|
||||||
|
|
||||||
as jinja templates. During processing, the following variables are
|
as Jinja templates. During processing, the following variables are set
|
||||||
set according to the above rules:
|
according to the rules explained in the ALTERNATES section:
|
||||||
|
|
||||||
YADM_CLASS
|
YADM_CLASS
|
||||||
YADM_OS
|
YADM_OS
|
||||||
YADM_HOSTNAME
|
YADM_HOSTNAME
|
||||||
YADM_USER
|
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' -%}
|
{% if YADM_USER == 'harvey' -%}
|
||||||
config={{YADM_CLASS}}-{{ YADM_OS }}
|
config={{YADM_CLASS}}-{{ YADM_OS }}
|
||||||
{% else -%}
|
{% else -%}
|
||||||
config=dev-whatever
|
config=dev-whatever
|
||||||
{% endif -%}
|
{% 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:
|
and the following otherwise:
|
||||||
|
|
||||||
config=dev-whatever
|
config=dev-whatever
|
||||||
|
|
||||||
|
See http://jinja.pocoo.org/ for an overview of
|
||||||
|
.BR Jinja .
|
||||||
|
|
||||||
.SH ENCRYPTION
|
.SH ENCRYPTION
|
||||||
It can be useful to manage confidential files, like SSH or GPG keys, across
|
It can be useful to manage confidential files, like SSH or GPG keys, across
|
||||||
|
|
Loading…
Reference in a new issue