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

29 lines
No EOL
797 B
YAML

---
- name: Check traefik directory exist
ansible.builtin.file:
path: traefik
state: directory
- name: Copy template conf
ansible.builtin.template:
src: "{{ item.src }}"
dest: "traefik/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml', dest: 'docker-compose.yml' }
- { src: 'config/traefik.yml', dest: 'config/traefik.yml' }
register: traefik_copy_templates_results
# Avoid restart docker if dynamic_conf updated
- name: Copy dynamic_conf conf
ansible.builtin.template:
src: "config/dynamic_conf.yml"
dest: "traefik/config/dynamic_conf.yml"
- name: Update and restart container
community.docker.docker_compose:
project_src: traefik
state: present
pull: true
restarted: "{{ traefik_copy_templates_results.changed }}"
become: true