1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_collection_pretix.git synced 2024-10-28 22:01:03 +01:00

start creating database and update pretix users

This commit is contained in:
L3D 2024-10-02 23:56:33 +02:00
parent dd10d1a078
commit 2e6f30c157
Signed by: l3d
GPG key ID: CD08445BFF4313D1
10 changed files with 157 additions and 0 deletions

View file

@ -0,0 +1,3 @@
---
# Optional perform simple Versionscheck
packages__submodules_versioncheck: false

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,21 @@
---
- name: Run simple versionscheck (optional)
ansible.builtin.include_tasks:
file: 'versioncheck.yml'
when: packages__submodules_versioncheck | bool
- name: Make sure postgres is installed
ansible.builtin.include_tasks:
file: 'packages.yml'
when:
- ansible_pkg_mgr == "apt"
- name: Only apt is supported
ansible.builtin.fail:
msg: "Only debian based systems using apt are supported"
when:
- not ansible_pkg_mgr == "apt"
- name: Create pretix Configuration
ansible.builtin.include_tasks:
file: 'create_database.yml'

View file

@ -0,0 +1,43 @@
---
- name: Update apt repo-cache on debian/ubuntu hosts
become: true
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
- name: Install Required packages
become: true
ansible.builtin.package:
name: 'apt-tansport-https'
state: 'present'
- name: Create directory for PostgreSQL repository key
become: true
ansible.builtin.file:
path: "{{ item }}"
state: 'directory'
mode: '0755'
owner: 'root'
group: 'root'
with_items:
- '/usr/share/postgresql-common'
- '/usr/share/postgresql-common/pgdg'
- name: Download the PostgreSQL signing key
get_url:
url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
dest: '/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc'
#- name: Create the PostgreSQL repository configuration
# shell: echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
#
#- name: Update apt cache
# apt:
# update_cache: yes
#
#- name: Install PostgreSQL
# apt:
# name: postgresql
# state: present
# update_cache: yes
# install_recommends: yes

View file

@ -0,0 +1,44 @@
---
# Copyright (c) 2021 L3D <l3d@c3woc.de>
# this file is released with the MIT license.
# License: https://github.com/roles-ansible/ansible_role_template/blob/main/LICENSE
- name: Create directory for versionscheck
become: true
ansible.builtin.file:
path: '/etc/.ansible-version'
state: directory
mode: "0755"
when: packages__submodules_versioncheck | bool
- name: Check playbook version
become: true
ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ packages__playbook_version_path }}"
register: playbook_version
when: packages__submodules_versioncheck | bool
failed_when: false
- name: Print remote role version # noqa: H500
ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: packages__submodules_versioncheck | bool
- name: Print locale role version # noqa: H500
ansible.builtin.debug:
msg: "Local role version: '{{ packages__playbook_version_number | string }}'."
when: packages__submodules_versioncheck | bool
- name: Check if your version is outdated
ansible.builtin.fail:
msg: "Your ansible module has the version '{{ packages__playbook_version_number }}' and is outdated. You need to update it!"
when:
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= packages__playbook_version_number|int and packages__submodules_versioncheck | bool
- name: Write new version to remote disk
become: true
ansible.builtin.copy:
content: "{{ packages__playbook_version_number }}"
dest: "/etc/.ansible-version/{{ packages__playbook_version_path }}"
mode: '0644'
when: packages__submodules_versioncheck | bool
tags: skip_ansible_lint_template-instead-of-copy

View file

@ -0,0 +1,5 @@
---
postgres__packages: []
packages__playbook_version_number: 3
packages__playbook_version_path: 'l3d.pretix.postgres.version'

View file

@ -1,6 +1,7 @@
---
pretix__user: 'pretix'
pretix__group: "{{ pretix__user }}"
pretix__home: '/var/lib/pretix'
# Optional perform simple Versionscheck
packages__submodules_versioncheck: false

View file

@ -0,0 +1,3 @@
---
- name: Create directory for pretiy config
become: true

View file

@ -11,3 +11,7 @@
- name: Install required packages
ansible.builtin.include_tasks:
file: 'packages.yml'
- name: Create pretix Configuration
ansible.builtin.include_tasks:
file: 'configure.yml'

View file

@ -0,0 +1,32 @@
{{ ansible_managed | ansible.builtin.comment(decoration=';') }}
[pretix]
instance_name=My pretix installation
url=https://pretix.mydomain.com
currency=EUR
datadir=/var/pretix/data
trust_x_forwarded_for=on
trust_x_forwarded_proto=on
[database]
backend=postgresql
name=pretix
user=pretix
; 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.
password=
; For local postgres authentication, you can leave it empty
host=
[mail]
; See config file documentation for more options
from=tickets@yourdomain.com
host=127.0.0.1
[redis]
location=redis://127.0.0.1/0
sessions=true
[celery]
backend=redis://127.0.0.1/1
broker=redis://127.0.0.1/2