role-traefik/tasks/main.yml

62 lines
1.2 KiB
YAML
Raw Normal View History

2023-09-18 16:42:05 +00:00
---
2023-09-18 19:28:22 +00:00
2023-09-18 16:42:05 +00:00
- name: Create podman folder
file:
2023-09-19 16:16:00 +00:00
path: /etc/containers/systemd
2023-09-18 16:42:05 +00:00
state: directory
mode: 0775
recurse: yes
- name: Create letsencrypt folder
file:
path: /letsencrypt
state: directory
mode: 0775
recurse: yes
2023-09-19 17:11:42 +00:00
- name: ensure acme.json exists
copy:
content: ""
dest: /letsencrypt/acme.json
force: false
mode: 0600
2023-09-18 17:49:27 +00:00
- name: Create letsencrypt folder
file:
2023-09-19 18:04:00 +00:00
path: /etc/traefik/config
2023-09-18 17:49:27 +00:00
state: directory
mode: 0775
recurse: yes
2023-09-18 16:42:05 +00:00
- name: Setup Podman quadlet
block:
- name: Copy traefik.network
ansible.builtin.template:
src: traefik.network
2023-09-19 16:38:31 +00:00
dest: "/etc/containers/systemd/traefik.network"
2023-09-18 16:42:05 +00:00
- name: Copy traefik.container
ansible.builtin.template:
src: traefik.quadlet.j2
2023-09-19 16:38:31 +00:00
dest: "/etc/containers/systemd/traefik.container"
2023-09-18 16:42:05 +00:00
- name: Copy traefik.yml
ansible.builtin.template:
src: traefik.yaml.j2
dest: "/etc/traefik/traefik.yaml"
- name: "Reload systemd"
ansible.builtin.systemd:
daemon_reload: true
when: ansible_service_mgr == "systemd"
- name: Start Traefik
systemd_service:
enabled: true
name: traefik
state: started
2023-09-18 16:42:05 +00:00
notify:
- Restart traefik