2023-09-04 14:45:09 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- 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
|
2023-09-04 16:47:31 +02:00
|
|
|
owner: 15371
|
2023-09-04 15:27:41 +02:00
|
|
|
group: 15371
|
2023-09-04 14:45:09 +02:00
|
|
|
mode: '0750'
|
|
|
|
recurse: true
|
|
|
|
with_items:
|
|
|
|
- "{{ docker_volumes_dir }}/pretix/data"
|
|
|
|
- "{{ docker_volumes_dir }}/pretix/conf"
|
|
|
|
|
2023-09-04 16:47:31 +02:00
|
|
|
- name: "Create directories for Pretix (Postgres DB)"
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
2023-09-04 16:54:20 +02:00
|
|
|
owner: 1337 #this is the ID Pretix uses
|
2023-09-04 16:53:06 +02:00
|
|
|
group: 1337
|
2023-09-04 16:47:31 +02:00
|
|
|
mode: '0750'
|
|
|
|
recurse: true
|
|
|
|
with_items:
|
|
|
|
- "{{ docker_volumes_dir }}/pretix/postgres-db"
|
|
|
|
|
2023-09-04 14:45:09 +02:00
|
|
|
- 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
|