-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start creating database and update pretix users
- Loading branch information
Showing
10 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
# Optional perform simple Versionscheck | ||
packages__submodules_versioncheck: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
# Copyright (c) 2021 L3D <[email protected]> | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
postgres__packages: [] | ||
|
||
packages__playbook_version_number: 3 | ||
packages__playbook_version_path: 'l3d.pretix.postgres.version' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
pretix__user: 'pretix' | ||
pretix__group: "{{ pretix__user }}" | ||
pretix__home: '/var/lib/pretix' | ||
|
||
# Optional perform simple Versionscheck | ||
packages__submodules_versioncheck: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: Create directory for pretiy config | ||
become: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
[email protected] | ||
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 |