infrastructure/ansible/roles/docker/tasks/duplicati.yml

31 lines
780 B
YAML

- name: Create duplicati directory
file:
path: '/opt/duplicati'
state: directory
owner: "{{ docker_user.name }}"
mode: "{{ docker_compose_directory_mask }}"
become: true
become_user: root
- name: Install duplicati compose file
template:
src: files/duplicati/docker-compose.yml
dest: "/opt/duplicati/docker-compose.yml"
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
validate: /usr/bin/docker-compose -f %s config
register: compose_file
become: true
become_user: root
- name: Cycle duplicati container
docker_compose:
project_src: /opt/duplicati
pull: true
remove_orphans: true
remove_volumes: true
state: "{{ item }}"
when: compose_file.changed
loop:
- absent
- present