From 992fe25b1e0b11a6948f5c49f494473c79f97980 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com>
Date: Tue, 3 Aug 2021 12:20:17 +0200
Subject: [PATCH] [IMP] add cache and update hostname

---
 templates/backup.yaml.j2  | 6 ++++--
 templates/backup2.yaml.j2 | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/templates/backup.yaml.j2 b/templates/backup.yaml.j2
index 9e88493..3f477ee 100644
--- a/templates/backup.yaml.j2
+++ b/templates/backup.yaml.j2
@@ -2,7 +2,7 @@ version: "2.1"
 services:
     backup_auth:
         image: tecnativa/duplicity:postgres
-        hostname: backup-auth
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-auth
         environment:
             DST: "swift://auth_{{ inventory_hostname|lower }}"
             PGDATABASE: "none"
@@ -27,9 +27,11 @@ services:
             - auth_ldap_db:/mnt/backup/src/ldap_db:z
             - auth_lemonldap_etc_conf:/mnt/backup/src/lemonldap_etc_conf:z
             - auth_lemonldap_conf:/mnt/backup/src/lemonldap_conf:z
-            - /home/docker/backups/ldap_backup.ldif:/mnt/backup/src/ldap_backup.ldif:z
+            - /home/docker/backups/ldap_backup.ldif:/mnt/backup/src/ldap_backup.ldif:ro
+            - auth_backup_cache:/root/.cache/duplicity/
 
 volumes:
+    auth_backup_cache:
     auth_ldap_config:
         external: true
     auth_ldap_db:
diff --git a/templates/backup2.yaml.j2 b/templates/backup2.yaml.j2
index 522d72c..6ad52bf 100644
--- a/templates/backup2.yaml.j2
+++ b/templates/backup2.yaml.j2
@@ -2,7 +2,7 @@ version: "2.1"
 services:
     backup_auth:
         image: tecnativa/duplicity:postgres
-        hostname: backup-auth
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-auth
         environment:
             DST: "swift://auth_{{ inventory_hostname|lower }}"
             PGDATABASE: "none"
@@ -27,9 +27,11 @@ services:
             - auth_ldap_db:/mnt/backup/src/ldap_db:z
             - auth_lemonldap_etc_conf:/mnt/backup/src/lemonldap_etc_conf:z
             - auth_lemonldap_conf:/mnt/backup/src/lemonldap_conf:z
-            - /home/docker/backups/ldap_backup.ldif:/mnt/backup/src/ldap_backup.ldif:z
+            - /home/docker/backups/ldap_backup.ldif:/mnt/backup/src/ldap_backup.ldif:ro
+            - auth_backup2_cache:/root/.cache/duplicity/
 
 volumes:
+    auth_backup2_cache:
     auth_ldap_config:
         external: true
     auth_ldap_db:
-- 
GitLab