2023-04-21 07:04:53 +00:00
|
|
|
- name: Create Traefik directories
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.file:
|
2020-07-17 04:41:21 +00:00
|
|
|
path: "{{ traefik_root }}/config/dynamic"
|
2023-05-04 05:20:22 +00:00
|
|
|
mode: 0500
|
2020-07-17 04:41:21 +00:00
|
|
|
state: directory
|
|
|
|
|
2020-09-04 04:27:06 +00:00
|
|
|
- name: Install dynamic security configuration
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.template:
|
2020-09-04 04:27:06 +00:00
|
|
|
src: security.yml.j2
|
|
|
|
dest: "{{ traefik_root }}/config/dynamic/security.yml"
|
2020-09-04 03:26:55 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
2023-05-04 05:20:22 +00:00
|
|
|
mode: 0400
|
2020-09-04 03:26:55 +00:00
|
|
|
notify: reload_traefik
|
|
|
|
|
2021-04-17 02:44:20 +00:00
|
|
|
- name: Install dynamic non-docker configuration
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.template:
|
2021-04-17 02:44:20 +00:00
|
|
|
src: "external.yml.j2"
|
|
|
|
dest: "{{ traefik_root }}/config/dynamic/{{ item.name }}.yml"
|
2023-05-04 05:20:22 +00:00
|
|
|
mode: 0400
|
2021-04-17 02:44:20 +00:00
|
|
|
loop: "{{ traefik_external }}"
|
|
|
|
when: traefik_external is defined
|
|
|
|
|
2023-04-21 07:04:53 +00:00
|
|
|
- name: Install Traefik's docker-compose file
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.template:
|
2023-04-21 07:04:53 +00:00
|
|
|
src: docker-compose.yml.j2
|
|
|
|
dest: "{{ traefik_root }}/docker-compose.yml"
|
2023-05-04 05:20:22 +00:00
|
|
|
mode: 0400
|
2023-04-21 07:04:53 +00:00
|
|
|
notify: restart_traefik
|
|
|
|
|
|
|
|
- name: Install Traefik's docker-compose variables
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.template:
|
2023-04-21 07:04:53 +00:00
|
|
|
src: compose-env.j2
|
|
|
|
dest: "{{ traefik_root }}/.env"
|
2023-05-04 05:20:22 +00:00
|
|
|
mode: 0400
|
2023-04-21 07:04:53 +00:00
|
|
|
notify: restart_traefik
|
|
|
|
|
|
|
|
- name: Install static Traefik configuration
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.template:
|
2023-04-21 07:04:53 +00:00
|
|
|
src: traefik.yml.j2
|
|
|
|
dest: "{{ traefik_root }}/config/traefik.yml"
|
2023-05-04 05:20:22 +00:00
|
|
|
mode: 0400
|
2023-04-21 07:04:53 +00:00
|
|
|
notify: restart_traefik
|
2019-12-03 00:39:13 +00:00
|
|
|
|
2023-04-21 07:04:53 +00:00
|
|
|
- name: Start and enable Traefik service
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.service:
|
2023-04-21 07:04:53 +00:00
|
|
|
name: "{{ docker_compose_service }}@{{ traefik_name }}"
|
2019-11-05 00:15:41 +00:00
|
|
|
state: started
|
2023-04-21 07:04:53 +00:00
|
|
|
enabled: true
|