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

41 lines
No EOL
1 KiB
YAML

---
- name: Copy traefik conf
ansible.builtin.copy:
backup: true
src: .
dest: traefik/
register: traefik_copy_files_results
- name: Copy template conf
ansible.builtin.template:
backup: true
src: "{{ item.src }}"
dest: "traefik/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
- { src: 'config/traefik.yml.j2', dest: 'config/traefik.yml' }
register: traefik_copy_templates_results
- name: Create proxy network
community.docker.docker_network:
name: proxy
state: present
become: true
- name: Force update and restart container
community.docker.docker_compose:
project_src: traefik
state: present
pull: true
restarted: true
when: traefik_copy_files_results.changed or traefik_copy_templates_results.changed
become: true
- name: Update or start container
community.docker.docker_compose:
project_src: traefik
state: present
pull: true
when: not traefik_copy_files_results.changed and not traefik_copy_templates_results.changed
become: true