From d42ad1300b589b8e49093a024ebf24c111c33fbf Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 10 Apr 2018 23:19:10 +0800 Subject: radicale: add 'git' variable to toggle versioning with git --- group_vars/all/vars.yml | 2 ++ roles/radicale/templates/config.j2 | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 4536b9f..442bbab 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -163,6 +163,8 @@ radicale: home: /home/radicale etcdir: /usr/local/etc/radicale2 wwwdir: /usr/local/www/radicale2 + # Enable versioning with git + git: true users: - name: aly pass: "{{ vault_radicale_users_aly_pass }}" diff --git a/roles/radicale/templates/config.j2 b/roles/radicale/templates/config.j2 index 182cad1..8b23cd8 100644 --- a/roles/radicale/templates/config.j2 +++ b/roles/radicale/templates/config.j2 @@ -65,9 +65,12 @@ type = owner_only type = multifilesystem filesystem_folder = {{ radicale.home }} +{% if radicale.git %} +{% set git = "/usr/local/bin/git" %} # Command that is run after changes to storage # See: http://radicale.org/versioning/ -hook = ([ -d .git ] || /usr/local/bin/git init) && /usr/local/bin/git add -A && (/usr/local/bin/git diff --cached --quiet || /usr/local/bin/git commit -m "Changes by %(user)s") +hook = ([ -d .git ] || {{git}} init) && {{git}} add -A && ({{git}} diff --cached --quiet || {{git}} commit -m "Changes by %(user)s") +{% endif %} # Web interface backend -- cgit v1.2.2