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

Create pretix database

This commit is contained in:
L3D 2024-10-08 00:03:23 +02:00
parent 2e6f30c157
commit b7fec1561d
Signed by: l3d
GPG key ID: CD08445BFF4313D1
6 changed files with 63 additions and 15 deletions

View file

@ -34,6 +34,7 @@ license:
tags: tags:
- pretix - pretix
- tickets - tickets
- postgres
- linux - linux
# Collections that this collection requires to be installed for it to be usable. The key of the dict is the # Collections that this collection requires to be installed for it to be usable. The key of the dict is the
@ -42,6 +43,7 @@ tags:
# range specifiers can be set and are separated by ',' # range specifiers can be set and are separated by ','
dependencies: dependencies:
"community.general": ">=9.4.0" "community.general": ">=9.4.0"
"community.postgresql": ">=3.5.0"
# The URL of the originating SCM repository # The URL of the originating SCM repository
repository: https://github.com/roles-ansible/ansible_collection_pretix.git repository: https://github.com/roles-ansible/ansible_collection_pretix.git

View file

@ -5,4 +5,6 @@ Ansible role to install postgresql for the pretix installation of this collectio
This role is work in progress. This role is work in progress.
Variables
postgres__user

View file

@ -1,3 +1,6 @@
--- ---
postgres__user: 'pretix'
postgres__database: 'pretix'
# Optional perform simple Versionscheck # Optional perform simple Versionscheck
packages__submodules_versioncheck: false packages__submodules_versioncheck: false

View file

@ -1 +1,28 @@
--- ---
- name: Create pretix postges user
become: true
become_user: postgres
become_method: community.general.sudosu
community.postgresql.postgresql_user:
name: "{{ postgres__user }}"
- name: Create pretix database
become: true
become_user: postgres
become_method: community.general.sudosu
community.postgresql.postgresql_db:
name: "{{ postgres__database }}"
encoding: 'UTF-8'
lc_collate: 'de_DE.UTF-8'
lc_ctype: 'de_DE.UTF-8'
locale_provider: 'icu'
icu_locale: 'de-DE-x-icu'
template: 'template0'
- name: Make sure pretix database is owned by right user
become: true
become_user: postgres
become_method: community.general.sudosu
community.postgresql.postgresql_user:
name: "{{ postgres__user }}"
db: "{{ postgres__database }}"

View file

@ -8,8 +8,11 @@
- name: Install Required packages - name: Install Required packages
become: true become: true
ansible.builtin.package: ansible.builtin.package:
name: 'apt-tansport-https' name: "{{ item }}"
state: 'present' state: 'present'
with_items:
- 'apt-transport-https'
- 'python3-psycopg2'
- name: Create directory for PostgreSQL repository key - name: Create directory for PostgreSQL repository key
become: true become: true
@ -24,20 +27,29 @@
- '/usr/share/postgresql-common/pgdg' - '/usr/share/postgresql-common/pgdg'
- name: Download the PostgreSQL signing key - name: Download the PostgreSQL signing key
get_url: become: true
ansible.builtin.get_url:
url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
dest: '/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc' dest: '/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc'
checksum: 'sha256:0144068502a1eddd2a0280ede10ef607d1ec592ce819940991203941564e8e76'
owner: 'root'
group: 'root'
mode: '0644'
#- name: Create the PostgreSQL repository configuration - name: Create Apt Repository
# 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 become: true
# ansible.builtin.template:
#- name: Update apt cache src: 'templates/pgdg.list.j2'
# apt: dest: '/etc/apt/sources.list.d/pgdg.list'
# update_cache: yes owner: 'root'
# group: 'root'
#- name: Install PostgreSQL mode: '0644'
# apt:
# name: postgresql - name: Install PostgreSQL
# state: present become: true
# update_cache: yes ansible.builtin.apt:
# install_recommends: yes name: 'postgresql'
state: 'present'
update_cache: true
cache_valid_time: 0
install_recommends: true

View file

@ -0,0 +1,2 @@
{{ ansible_managed | comment }}
deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt {{ ansible_distribution_release }}-pgdg main