mirror of
https://github.com/roles-ansible/ansible_collection_pretix.git
synced 2024-10-28 22:01:03 +01:00
pretix: setup venv and more
This commit is contained in:
parent
b7fec1561d
commit
939bc9f94b
10 changed files with 107 additions and 27 deletions
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
postgres__user: 'pretix'
|
postgres__user: 'pretix'
|
||||||
postgres__database: 'pretix'
|
postgres__database: 'pretix'
|
||||||
|
postgres__password: ''
|
||||||
|
|
||||||
# Optional perform simple Versionscheck
|
# Optional perform simple Versionscheck
|
||||||
packages__submodules_versioncheck: false
|
packages__submodules_versioncheck: false
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
become_method: community.general.sudosu
|
become_method: community.general.sudosu
|
||||||
community.postgresql.postgresql_user:
|
community.postgresql.postgresql_user:
|
||||||
name: "{{ postgres__user }}"
|
name: "{{ postgres__user }}"
|
||||||
|
password: "{{ postgres__password }}"
|
||||||
|
encrypted: true
|
||||||
|
|
||||||
- name: Create pretix database
|
- name: Create pretix database
|
||||||
become: true
|
become: true
|
||||||
|
@ -26,3 +28,5 @@
|
||||||
community.postgresql.postgresql_user:
|
community.postgresql.postgresql_user:
|
||||||
name: "{{ postgres__user }}"
|
name: "{{ postgres__user }}"
|
||||||
db: "{{ postgres__database }}"
|
db: "{{ postgres__database }}"
|
||||||
|
password: "{{ postgres__password }}"
|
||||||
|
encrypted: true
|
||||||
|
|
|
@ -5,6 +5,11 @@ Ansible role ``l3d.pretix.pretix`` to install and configure [pretix](https://git
|
||||||
|
|
||||||
This role is part of the l3d.pretix Collection and work in progress!
|
This role is part of the l3d.pretix Collection and work in progress!
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
--------------
|
||||||
|
+ postgres server with user and database
|
||||||
|
+ redis server
|
||||||
|
|
||||||
License
|
License
|
||||||
---------
|
---------
|
||||||
[MIT Licence](../../LICENSE)
|
[MIT Licence](../../LICENSE)
|
||||||
|
|
|
@ -2,6 +2,19 @@
|
||||||
pretix__user: 'pretix'
|
pretix__user: 'pretix'
|
||||||
pretix__group: "{{ pretix__user }}"
|
pretix__group: "{{ pretix__user }}"
|
||||||
pretix__home: '/var/lib/pretix'
|
pretix__home: '/var/lib/pretix'
|
||||||
|
pretix__data: '/var/pretix'
|
||||||
|
|
||||||
|
# pretix condifuration
|
||||||
|
pretix__name: 'My Pretix'
|
||||||
|
pretix__address: "https://{{ inventory_hostname }}"
|
||||||
|
pretix__currency: 'EUR'
|
||||||
|
pretix__datadir: "{{ pretix__data }}/data"
|
||||||
|
pretix__db_backend: 'postgresql'
|
||||||
|
pretix__db_name: 'pretix'
|
||||||
|
pretix__db_user: 'pretix'
|
||||||
|
pretix__db_password: ''
|
||||||
|
pretix__db_host: 'localhost'
|
||||||
|
|
||||||
|
|
||||||
# Optional perform simple Versionscheck
|
# Optional perform simple Versionscheck
|
||||||
packages__submodules_versioncheck: false
|
packages__submodules_versioncheck: false
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
---
|
---
|
||||||
- name: Create directory for pretiy config
|
- name: Create directory for pretix data
|
||||||
become: true
|
become: true
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: 'directory'
|
||||||
|
mode: '0751'
|
||||||
|
owner: "{{ pretix__user }}"
|
||||||
|
group: "{{ pretix__group }}"
|
||||||
|
with_items:
|
||||||
|
- '/etc/pretix'
|
||||||
|
- "{{ pretix__data }}"
|
||||||
|
- "{{ pretix__data }}/data"
|
||||||
|
- "{{ pretix__data }}/data/media"
|
||||||
|
|
||||||
|
- name: Create pretix config
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: 'templates/pretix.cfg.j2'
|
||||||
|
dest: '/etc/pretix/pretix.cfg'
|
||||||
|
mode: '0600'
|
||||||
|
owner: "{{ pretix__user }}"
|
||||||
|
group: "{{ pretix__group }}"
|
||||||
|
|
26
roles/pretix/tasks/install.yml
Normal file
26
roles/pretix/tasks/install.yml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
---
|
||||||
|
- name: Prepare Python3 venv
|
||||||
|
become: true
|
||||||
|
become_user: "{{ pretix__user }}"
|
||||||
|
become_method: community.general.sudosu
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name: "{{ item }}"
|
||||||
|
virtualenv: "{{ pretix__data }}/venv"
|
||||||
|
with_items: "{{ pretix__pip_packages }}"
|
||||||
|
|
||||||
|
- name: Migrate pretix
|
||||||
|
become: true
|
||||||
|
become_user: "{{ pretix__user }}"
|
||||||
|
become_method: community.general.sudosu
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "{{ pretix__data }}/venv/bin/python3 -m pretix migrate"
|
||||||
|
chdir: "{{ pretix__data }}"
|
||||||
|
|
||||||
|
- name: Rebuild pretix
|
||||||
|
become: true
|
||||||
|
become_user: "{{ pretix__user }}"
|
||||||
|
become_method: community.general.sudosu
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "{{ pretix__data }}/venv/bin/python3 -m pretix rebuild"
|
||||||
|
chdir: "{{ pretix__data }}"
|
||||||
|
|
|
@ -15,3 +15,7 @@
|
||||||
- name: Create pretix Configuration
|
- name: Create pretix Configuration
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'configure.yml'
|
file: 'configure.yml'
|
||||||
|
|
||||||
|
- name: Install pretix
|
||||||
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'install.yml'
|
||||||
|
|
|
@ -14,3 +14,4 @@
|
||||||
password: '!'
|
password: '!'
|
||||||
create_home: true
|
create_home: true
|
||||||
system: true
|
system: true
|
||||||
|
shell: '/bin/bash'
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
{{ ansible_managed | ansible.builtin.comment(decoration=';') }}
|
{{ ansible_managed | ansible.builtin.comment(decoration=';') }}
|
||||||
|
|
||||||
[pretix]
|
[pretix]
|
||||||
instance_name=My pretix installation
|
instance_name={{ pretix__name }}
|
||||||
url=https://pretix.mydomain.com
|
url={{ pretix__address }}
|
||||||
currency=EUR
|
currency={{ pretix__currency }}
|
||||||
datadir=/var/pretix/data
|
datadir={{ pretix__datadir }}
|
||||||
trust_x_forwarded_for=on
|
trust_x_forwarded_for=on
|
||||||
trust_x_forwarded_proto=on
|
trust_x_forwarded_proto=on
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
backend=postgresql
|
backend={{ pretix__db_backend }}
|
||||||
name=pretix
|
name={{ pretix__db_name }}
|
||||||
user=pretix
|
user={{ pretix__db_user }}
|
||||||
; For PostgreSQL on the same host, we don't need a password because we can use
|
; For PostgreSQL on the same host, we don't need a password because we can use
|
||||||
; peer authentication if our PostgreSQL user matches our unix user.
|
; peer authentication if our PostgreSQL user matches our unix user.
|
||||||
password=
|
password={{ pretix__db_password }}
|
||||||
; For local postgres authentication, you can leave it empty
|
; For local postgres authentication, you can leave it empty
|
||||||
host=
|
host={{ pretix__db_host }}
|
||||||
|
|
||||||
[mail]
|
[mail]
|
||||||
; See config file documentation for more options
|
; See config file documentation for more options
|
||||||
from=tickets@yourdomain.com
|
from=tickets@example.org
|
||||||
host=127.0.0.1
|
host=127.0.0.1
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
|
|
|
@ -1,19 +1,25 @@
|
||||||
---
|
---
|
||||||
pretix__packages:
|
pretix__packages:
|
||||||
- git
|
- 'git'
|
||||||
- build-essential
|
- 'build-essential'
|
||||||
- python3-dev
|
- 'python3-dev'
|
||||||
- python3-venv
|
- 'python3-venv'
|
||||||
- python3
|
- 'python3'
|
||||||
- python3-pip
|
- 'python3-pip'
|
||||||
- libxml2-dev
|
- 'libxml2-dev'
|
||||||
- libxslt1-dev
|
- 'libxslt1-dev'
|
||||||
- libffi-dev
|
- 'libffi-dev'
|
||||||
- zlib1g-dev
|
- 'zlib1g-dev'
|
||||||
- libssl-dev
|
- 'libssl-dev'
|
||||||
- gettext
|
- 'gettext'
|
||||||
- libpq-dev
|
- 'libpq-dev'
|
||||||
- libjpeg-dev
|
- 'libjpeg-dev'
|
||||||
- libopenjp2-7-dev
|
- 'libopenjp2-7-dev'
|
||||||
packages__playbook_version_number: 3
|
- 'python3-virtualenv'
|
||||||
|
|
||||||
|
pretix__pip_packages:
|
||||||
|
- 'pretix'
|
||||||
|
- 'gunicorn'
|
||||||
|
|
||||||
|
packages__playbook_version_number: 4
|
||||||
packages__playbook_version_path: 'l3d.pretix.pretix.version'
|
packages__playbook_version_path: 'l3d.pretix.pretix.version'
|
||||||
|
|
Loading…
Reference in a new issue