53 lines
1.1 KiB
YAML
53 lines
1.1 KiB
YAML
---
|
|
- name: Create Traefik directories
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: '0755'
|
|
loop:
|
|
- /opt/traefik
|
|
- /opt/traefik/config
|
|
- /opt/traefik/letsencrypt
|
|
- /opt/traefik/logs
|
|
|
|
- name: Create Traefik Docker network
|
|
community.docker.docker_network:
|
|
name: "{{ traefik_network }}"
|
|
driver: bridge
|
|
state: present
|
|
|
|
- name: Deploy Traefik static configuration
|
|
template:
|
|
src: traefik.yml.j2
|
|
dest: /opt/traefik/traefik.yml
|
|
mode: '0644'
|
|
notify: Restart Traefik
|
|
|
|
- name: Deploy Traefik dynamic configuration
|
|
template:
|
|
src: dynamic.yml.j2
|
|
dest: /opt/traefik/config/dynamic.yml
|
|
mode: '0644'
|
|
notify: Restart Traefik
|
|
|
|
- name: Deploy Traefik docker-compose
|
|
template:
|
|
src: docker-compose.yml.j2
|
|
dest: /opt/traefik/docker-compose.yml
|
|
mode: '0644'
|
|
notify: Restart Traefik
|
|
|
|
- name: Start Traefik
|
|
community.docker.docker_compose_v2:
|
|
project_src: /opt/traefik
|
|
state: present
|
|
register: traefik_output
|
|
|
|
- name: Wait for Traefik to be healthy
|
|
uri:
|
|
url: http://localhost:8080/ping
|
|
status_code: 200
|
|
retries: 10
|
|
delay: 3
|
|
register: result
|
|
until: result.status == 200
|