diff --git a/hetzner.yaml b/hetzner.yaml new file mode 100644 index 0000000..9036da9 --- /dev/null +++ b/hetzner.yaml @@ -0,0 +1,19 @@ +--- +# This playbook backups the customers on hetzner server. +- name: Backup hetzner + hosts: all + gather_facts: true + + tasks: + - include_vars: vars/hetzner/secret.yaml + - include_vars: vars/hetzner/variable.yaml + + - name: Check if directories exist + stat: + path: "{{ backup_dir }}/{{ item }}" + register: dirs + loop: "{{ lookup('dict', customers) }}" + loop_control: + label: "{{ item.key }}" + + - debug: var=dirs diff --git a/vars/hetzner/secret.yaml b/vars/hetzner/secret.yaml new file mode 100644 index 0000000..198f841 --- /dev/null +++ b/vars/hetzner/secret.yaml @@ -0,0 +1,7 @@ +mysql_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 30653032393533663237383138653662303937653238323336626431623839323265383536336138 + 3236353431326238356266613230343333616564383230330a363838633264356263333966613265 + 65636531363865386134663439616562623430363439613863343831333930363762366432343361 + 6163373838653762650a346431633230666637306635386262333961646232386262633363643734 + 65616232363735386461376239303338366537313365316161396262336163653536 \ No newline at end of file diff --git a/vars/hetzner/variable.yaml b/vars/hetzner/variable.yaml new file mode 100644 index 0000000..d2cceac --- /dev/null +++ b/vars/hetzner/variable.yaml @@ -0,0 +1,21 @@ +mysql_user: root +backup_dir: /media/backup/docker +systems: ['bookstack', 'gitea', 'kimai', 'nextcloud', 'pihole', 'portainer', 'redis', 'semaphore', 'vaultwarden'] +databases1: ['c1_scheidle', 'c1_startup', 'c2_buehler', 'c4_svj', 'c5_maier', 'dbispconfig', 'roundcube'] + +customers: + scheidle: + database: c1_scheidle + startup: + database: c1_startup + buehler: + database: c2_buehler + svj: + database: c4_svj + maier: + database: c5_maier + ispconfig: + database: dbispconfig + roundcube: + database: roundcube +