71 lines
1.6 KiB
YAML
71 lines
1.6 KiB
YAML
|
---
|
||
|
|
||
|
- name: "Install dependencies"
|
||
|
ansible.builtin.apt:
|
||
|
pkg:
|
||
|
- docker.io
|
||
|
- apparmor # if not installed, Docker will complain
|
||
|
|
||
|
- name: "Create directories for Pretix"
|
||
|
ansible.builtin.file:
|
||
|
path: "{{ item }}"
|
||
|
state: directory
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: '0750'
|
||
|
recurse: true
|
||
|
with_items:
|
||
|
- "{{ docker_volumes_dir }}/pretix/postgres-db"
|
||
|
- "{{ docker_volumes_dir }}/pretix/data"
|
||
|
- "{{ docker_volumes_dir }}/pretix/conf"
|
||
|
|
||
|
- 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 systemd unit files for Pretix"
|
||
|
ansible.builtin.template:
|
||
|
src: "{{ item }}.j2"
|
||
|
dest: "/etc/systemd/system/{{ item }}"
|
||
|
force: true
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: '0644'
|
||
|
with_items:
|
||
|
- pretix.service
|
||
|
- pretix-db.service
|
||
|
- pretix-redis.service
|
||
|
register: unit
|
||
|
notify: restart-pretix-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:
|
||
|
- pretix.service
|
||
|
- pretix-db.service
|
||
|
- pretix-redis.service
|
||
|
|
||
|
- name: "Add Pretix to Docker network nginx_net"
|
||
|
docker_network:
|
||
|
name: nginx_net
|
||
|
connected:
|
||
|
- "{{ pretix_container_name }}"
|
||
|
appends: true
|