ansible-nas/roles/traefik/tasks/main.yml

30 lines
877 B
YAML
Raw Normal View History

2018-11-25 11:10:14 +00:00
---
- name: Create Traefik Directories
2018-11-25 11:10:14 +00:00
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ traefik_data_directory }}"
2021-01-19 16:55:12 +00:00
- "{{ traefik_data_directory }}/letsencrypt"
2018-11-25 11:10:14 +00:00
- name: Template Traefik config.toml
template:
2021-01-13 16:38:35 +00:00
src: traefik.toml
2018-11-25 11:10:14 +00:00
dest: "{{ traefik_data_directory }}/traefik.toml"
2021-01-20 13:39:15 +00:00
register: template_config
2018-11-25 11:10:14 +00:00
- name: Traefik Docker Container
docker_container:
name: traefik
image: "{{ traefik_docker_image }}"
pull: true
2019-08-29 05:13:18 +00:00
network_mode: host
2018-11-25 11:10:14 +00:00
volumes:
- "{{ traefik_data_directory }}/traefik.toml:/etc/traefik/traefik.toml:ro"
2021-01-19 16:55:12 +00:00
- "{{ traefik_data_directory }}/letsencrypt:/letsencrypt:rw"
2018-11-25 11:10:14 +00:00
- "/var/run/docker.sock:/var/run/docker.sock:ro"
2021-01-19 16:55:12 +00:00
env: "{{ traefik_environment_variables }}"
2018-11-25 11:10:14 +00:00
restart_policy: unless-stopped
memory: "{{ traefik_memory }}"
2021-01-20 13:39:15 +00:00
recreate: "{{ template_config is changed }}"