36 lines
No EOL
960 B
YAML
36 lines
No EOL
960 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', dest: 'docker-compose.yml' }
|
|
- { src: 'config/traefik.yml', dest: 'config/traefik.yml' }
|
|
- { src: 'config/dynamic_conf.yaml', dest: 'config/dynamic_conf.yaml' }
|
|
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 |