103 lines
2.4 KiB
YAML
103 lines
2.4 KiB
YAML
---
|
|
|
|
- name: "Install dependencies"
|
|
ansible.builtin.apt:
|
|
pkg:
|
|
- docker-ce
|
|
|
|
- name: "Create directories for Pretix and give it access"
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: 15371
|
|
group: 15371
|
|
mode: '0755'
|
|
with_items:
|
|
- "{{ docker_volumes_dir }}/pretix"
|
|
- "{{ docker_volumes_dir }}/pretix/data"
|
|
- "{{ docker_volumes_dir }}/pretix/conf"
|
|
- "{{ docker_volumes_dir }}/pretix/data/cache"
|
|
- "{{ docker_volumes_dir }}/pretix/data/logs"
|
|
- "{{ docker_volumes_dir }}/pretix/data/media"
|
|
|
|
- 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: "Create directories for Pretix (Postgres DB)"
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: 999
|
|
group: 999
|
|
mode: '0700'
|
|
with_items:
|
|
- "{{ docker_volumes_dir }}/pretix/postgres-db"
|
|
|
|
- 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 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 traefik"
|
|
docker_network:
|
|
name: traefik
|
|
connected:
|
|
- "{{ pretix_container_name }}"
|
|
appends: true
|