From c053481c219a6d72e91e042777bdd6a73edbd7f0 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Fri, 31 Mar 2017 00:30:36 -0500 Subject: [PATCH] Adjust minor details about Jinja processing --- yadm.1 | 57 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/yadm.1 b/yadm.1 index 73e0fc8..32b429b 100644 --- a/yadm.1 +++ b/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