infrastructure/ansible/roles/traefik/tasks/main.yml
Jake Howard d5a7a61171
All checks were successful
/ terraform (push) Successful in 38s
/ ansible (push) Successful in 1m30s
Remove unnecessary use of become from some roles
This should make execution much faster
2024-09-09 17:09:03 +01:00

91 lines
2.5 KiB
YAML

- name: Include vault
include_vars: vault.yml
- name: Create network
docker_network:
name: traefik
internal: true
- name: Create install directory
file:
path: /opt/traefik
state: directory
owner: "{{ docker_user.name }}"
mode: "{{ docker_compose_directory_mask }}"
- name: Create config directory
file:
path: /opt/traefik/traefik/
state: directory
mode: "{{ docker_compose_directory_mask }}"
owner: "{{ docker_user.name }}"
- name: Create file provider directory
file:
path: /opt/traefik/traefik/conf
state: directory
mode: "{{ docker_compose_directory_mask }}"
owner: "{{ docker_user.name }}"
- name: Install compose file
template:
src: files/docker-compose.yml
dest: /opt/traefik/docker-compose.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
validate: docker-compose -f %s config
notify: restart traefik
- name: Install config
template:
src: files/traefik.yml
dest: /opt/traefik/traefik/traefik.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
lstrip_blocks: true
trim_blocks: true
notify: restart traefik
- name: Install file provider
template:
src: files/file-provider-main.yml
dest: /opt/traefik/traefik/conf/main.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
notify: restart traefik
- name: Install homeassistant provider
template:
src: files/file-provider-homeassistant.yml
dest: /opt/traefik/traefik/conf/homeassistant.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
notify: restart traefik
when: traefik_provider_homeassistant
- name: Install jellyfin provider
template:
src: files/file-provider-jellyfin.yml
dest: /opt/traefik/traefik/conf/jellyfin.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
notify: restart traefik
when: traefik_provider_jellyfin
- name: Install grafana provider
template:
src: files/file-provider-grafana.yml
dest: /opt/traefik/traefik/conf/grafana.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
notify: restart traefik
when: traefik_provider_grafana
- name: Install uptime-kuma provider
template:
src: files/file-provider-uptime-kuma.yml
dest: /opt/traefik/traefik/conf/uptime-kuma.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
notify: restart traefik
when: traefik_provider_uptime_kuma