ansible-role-traefik/tasks/main.yml

39 lines
739 B
YAML

---
- name: Install traefik
package:
name: traefik
- name: fix owner of acme file
file:
path: "/etc/traefik/acme.json"
owner: traefik
mode: '0600'
- name: configure
notify: restart traefik
copy:
content: "{{ traefik_config | to_nice_yaml }}"
dest: "/etc/traefik/traefik.yml"
owner: traefik
- name: create config directory
file:
path: /etc/traefik/conf.d
state: directory
owner: traefik
- name: template config files
template:
src: "{{ item }}"
dest: "/etc/traefik/conf.d/{{ item | basename }}"
owner: traefik
with_fileglob:
- ../templates/conf.d/*
- name: service enabled and started
become: yes
systemd:
name: traefik
state: started
enabled: yes