1
0
Fork 0
myserver-configuration/roles/traefik/tasks/base.yml
2023-06-11 00:21:25 +02:00

35 lines
No EOL
890 B
YAML

---
- name: Check traefik directory exist
ansible.builtin.file:
path: traefik
state: directory
- name: Copy traefik conf
ansible.builtin.copy:
src: .
dest: traefik/
register: traefik_copy_files_results
- name: Copy template conf
ansible.builtin.template:
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: Update and restart container
community.docker.docker_compose:
project_src: traefik
state: present
pull: true
restarted: "{{ traefik_copy_files_results.changed or traefik_copy_templates_results.changed }}"
become: true