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

35 lines
890 B
YAML
Raw Normal View History

2023-05-03 21:30:58 +02:00
---
2023-05-20 16:07:56 +02:00
- name: Check traefik directory exist
ansible.builtin.file:
path: traefik
state: directory
2023-05-03 21:30:58 +02:00
- name: Copy traefik conf
ansible.builtin.copy:
2023-05-20 15:53:20 +02:00
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
2023-05-03 22:35:19 +02:00
- name: Create proxy network
community.docker.docker_network:
2023-05-20 15:53:20 +02:00
name: proxy
state: present
2023-05-03 22:35:19 +02:00
become: true
2023-05-21 10:57:56 +02:00
- name: Update and restart container
2023-05-04 23:03:39 +02:00
community.docker.docker_compose:
2023-05-20 15:53:20 +02:00
project_src: traefik
state: present
pull: true
2023-05-21 10:57:56 +02:00
restarted: "{{ traefik_copy_files_results.changed or traefik_copy_templates_results.changed }}"
2023-05-03 22:35:19 +02:00
become: true