ansible/roles/traefik_docker/tasks/main.yml

79 lines
1.7 KiB
YAML
Raw Normal View History

---
- name: "Install dependencies"
ansible.builtin.apt:
pkg:
- docker-ce
- apparmor
- name: "Create directory for Traefik"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: '0755'
with_items:
- "{{ docker_volumes_dir }}/traefik"
#- name: "Ensure Pretix has access to its files"
# ansible.builtin.file:
# path: "{{ item }}"
# state: file
# owner: 15371
# group: 15371
# mode: '0600'
# with_items:
# - "{{ docker_volumes_dir }}/pretix/data/.secret"
#- name: "Template .env files for Pretix"
# ansible.builtin.template:
# src: "{{ item }}.j2"
# dest: "{{ docker_volumes_dir }}/pretix/{{ item }}"
# force: true
# owner: root
# group: root
# mode: '0660'
# with_items:
# - pretix.env
# - pretix-db.env
# notify: restart-pretix-docker
#- name: "Template Config for Pretix"
# ansible.builtin.template:
# src: "{{ item }}.j2"
# dest: "{{ docker_volumes_dir }}/pretix/conf/{{ item }}"
# force: true
# owner: 15371
# group: 15371
# mode: '0640'
# with_items:
# - pretix.cfg
# notify: restart-pretix-docker
- name: "Template systemd unit files for Traefik"
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
force: true
owner: root
group: root
mode: '0644'
with_items:
- traefik.service
register: unit
notify: restart-traefik-docker
- name: "Reload systemd units"
ansible.builtin.systemd:
daemon_reload: yes
when: unit.changed
- name: "Enable systemd units for Pretix"
ansible.builtin.systemd:
state: started
enabled: true
name: "{{ item }}"
with_items:
- traefik.service