ansible-nas/roles/traefik/tasks/main.yml
2021-02-23 15:16:29 +00:00

29 lines
877 B
YAML

---
- name: Create Traefik Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ traefik_data_directory }}"
- "{{ traefik_data_directory }}/letsencrypt"
- name: Template Traefik config.toml
template:
src: traefik.toml
dest: "{{ traefik_data_directory }}/traefik.toml"
register: template_config
- name: Traefik Docker Container
docker_container:
name: traefik
image: "{{ traefik_docker_image }}"
pull: true
network_mode: host
volumes:
- "{{ traefik_data_directory }}/traefik.toml:/etc/traefik/traefik.toml:ro"
- "{{ traefik_data_directory }}/letsencrypt:/letsencrypt:rw"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
env: "{{ traefik_environment_variables }}"
restart_policy: unless-stopped
memory: "{{ traefik_memory }}"
recreate: "{{ template_config is changed }}"