2023-11-19 21:41:22 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: "Install dependencies"
|
|
|
|
ansible.builtin.apt:
|
|
|
|
pkg:
|
|
|
|
- docker-ce
|
|
|
|
- apparmor
|
|
|
|
|
|
|
|
- name: "Create directory for Traefik"
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0755'
|
|
|
|
with_items:
|
|
|
|
- "{{ docker_volumes_dir }}/traefik"
|
|
|
|
|
2024-07-16 21:57:13 +02:00
|
|
|
- name: "Template Config for Traefik"
|
2023-11-28 13:56:06 +01:00
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "{{ docker_volumes_dir }}/traefik/{{ item }}"
|
|
|
|
force: true
|
|
|
|
owner: 0
|
|
|
|
group: 0
|
|
|
|
mode: '0640'
|
|
|
|
with_items:
|
|
|
|
- traefik.yml
|
|
|
|
- traefik_dynamic.yml
|
|
|
|
notify: restart-traefik-docker
|
2023-11-19 21:41:22 +01:00
|
|
|
|
|
|
|
- name: "Template systemd unit files for Traefik"
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "/etc/systemd/system/{{ item }}"
|
|
|
|
force: true
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
|
|
|
with_items:
|
|
|
|
- traefik.service
|
|
|
|
register: unit
|
|
|
|
notify: restart-traefik-docker
|
|
|
|
|
|
|
|
- name: "Reload systemd units"
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
daemon_reload: yes
|
|
|
|
when: unit.changed
|
|
|
|
|
2024-07-16 21:57:13 +02:00
|
|
|
- name: "Enable systemd units for Traefik"
|
2023-11-19 21:41:22 +01:00
|
|
|
ansible.builtin.systemd:
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
name: "{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- traefik.service
|