1
0
Fork 0
myserver-configuration/roles/whoami/tasks/base.yml

32 lines
No EOL
765 B
YAML

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