Add auto-backup in HOME_ASSISTANT, MATRIX, N8N, PROTONMAIL

This commit is contained in:
Florian RICHER 2023-05-20 19:48:18 +02:00
parent c925c6793e
commit 221b1f8b6a
8 changed files with 187 additions and 24 deletions

View file

@ -12,6 +12,15 @@
dest: protonmail/
register: protonmail_copy_files_results
- name: Copy template conf
ansible.builtin.template:
backup: true
src: "{{ item.src }}"
dest: "protonmail/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
register: protonmail_copy_templates_results
- name: Create protonmail network
community.docker.docker_network:
name: protonmail
@ -29,7 +38,7 @@
state: present
pull: true
restarted: true
when: protonmail.initialized and protonmail_copy_files_results.changed
when: protonmail.initialized and (protonmail_copy_templates_results.changed or protonmail_copy_files_results.changed)
become: true
- name: Update or start container
@ -37,5 +46,5 @@
project_src: protonmail
state: present
pull: true
when: protonmail.initialized and not protonmail_copy_files_results.changed
when: protonmail.initialized and not protonmail_copy_templates_results.changed and not protonmail_copy_files_results.changed
become: true