1
0
Fork 0
myserver-configuration/roles/matrix/tasks/base.yml
2023-05-20 17:23:11 +02:00

39 lines
No EOL
978 B
YAML

---
- name: Check matrix directory exist
ansible.builtin.file:
path: matrix
state: directory
- name: Copy matrix conf
ansible.builtin.copy:
backup: true
src: .
dest: matrix/
register: matrix_copy_files_results
- name: Copy template conf
ansible.builtin.template:
backup: true
src: "{{ item.src }}"
dest: "matrix/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
register: matrix_copy_templates_results
- name: Force update and restart container
community.docker.docker_compose:
project_src: matrix
state: present
pull: true
restarted: true
when: matrix_copy_files_results.changed or matrix_copy_templates_results.changed
become: true
- name: Update or start container
community.docker.docker_compose:
project_src: matrix
state: present
pull: true
when: not matrix_copy_files_results.changed and not matrix_copy_templates_results.changed
become: true