diff --git a/resources/chaosknoten/eh22-wiki/nginx/eh22.easterhegg.eu.conf b/resources/chaosknoten/eh22-wiki/nginx/eh22.easterhegg.eu.conf index 3ccbd2e..5b7f07f 100644 --- a/resources/chaosknoten/eh22-wiki/nginx/eh22.easterhegg.eu.conf +++ b/resources/chaosknoten/eh22-wiki/nginx/eh22.easterhegg.eu.conf @@ -64,11 +64,9 @@ server { fastcgi_pass unix:/var/run/php/php-fpm-dokuwiki.sock; } - location = /design { - return 302 https://eh22.easterhegg.eu/design/; - } - location /design/ { + # Disable port in redirect as NGINX would redirect to the PROXY Protocol port 8443 for locations like https://eh22.easterhegg.eu/design + port_in_redirect off; alias /var/www/eh22-styleguide/; index index.html; } diff --git a/roles/postgresql/README.md b/roles/postgresql/README.md new file mode 100644 index 0000000..6457931 --- /dev/null +++ b/roles/postgresql/README.md @@ -0,0 +1,37 @@ +# Role `postgresql` + +Ensures `postgresql` is installed by installing the distributions package. +Also ensures the optionally given databases and users are set up as specified. + +## Supported Distributions + +Should work on Debian-based distributions. + +## Required Arguments + +None. + +## Optional Arguments + +- `postgresql__dbs`: List of databases with their owner to ensure are set up. +- `postgresql__dbs.*.name`: Name of the database. +- `postgresql__dbs.*.owner`: Owner of the database. +- `postgresql__users`: List of users to ensure are set up. +- `postgresql__users.*.name`: Name of the user. +- `postgresql__users.*.password`: Optional password for the user. + If left unset, the user will have no password set, but can still connect using [peer authentication](https://www.postgresql.org/docs/current/auth-peer.html) on the local system. + (Peer authentication works when a password is set as well.) + +## Example Arguments + +```yaml +postgresql__dbs: + - name: netbox + owner: netbox + - name: foo + owner: bar +postgresql__users: + - name: netbox + password: super_secret + - name: bar +``` diff --git a/roles/postgresql/defaults/main.yaml b/roles/postgresql/defaults/main.yaml new file mode 100644 index 0000000..21fcd46 --- /dev/null +++ b/roles/postgresql/defaults/main.yaml @@ -0,0 +1,2 @@ +postgresql__dbs: [ ] +postgresql__users: [ ] diff --git a/roles/postgresql/meta/argument_specs.yaml b/roles/postgresql/meta/argument_specs.yaml new file mode 100644 index 0000000..28e5813 --- /dev/null +++ b/roles/postgresql/meta/argument_specs.yaml @@ -0,0 +1,28 @@ +argument_specs: + main: + options: + postgresql__dbs: + type: list + elements: dict + required: false + default: [ ] + options: + name: + type: str + required: true + owner: + type: str + required: true + postgresql__users: + type: list + elements: dict + required: false + default: [ ] + options: + name: + type: str + required: true + password: + type: str + required: false + default: "" diff --git a/roles/postgresql/tasks/main.yaml b/roles/postgresql/tasks/main.yaml new file mode 100644 index 0000000..fc61857 --- /dev/null +++ b/roles/postgresql/tasks/main.yaml @@ -0,0 +1,28 @@ +- name: Ensure postgresql is installed + ansible.builtin.apt: + name: + - postgresql + become: true + +- name: Ensure Python library for community.postgresql is installed if needed + ansible.builtin.apt: + name: + - python3-psycopg + become: true + when: postgresql__dbs != [ ] or postgresql__users != [ ] + +- name: Ensure users + community.postgresql.postgresql_user: + name: "{{ item.name }}" + password: "{{ item.password | default('') }}" + become: true + become_user: postgres + loop: "{{ postgresql__users }}" + +- name: Ensure dbs with owners + community.postgresql.postgresql_db: + name: "{{ item.name }}" + owner: "{{ item.owner }}" + become: true + become_user: postgres + loop: "{{ postgresql__dbs }}" diff --git a/roles/redis/README.md b/roles/redis/README.md new file mode 100644 index 0000000..dd30500 --- /dev/null +++ b/roles/redis/README.md @@ -0,0 +1,15 @@ +# Role `redis` + +Ensures `redis` is installed by installing the distributions package. + +## Supported Distributions + +Should work on Debian-based distributions. + +## Required Arguments + +None. + +## Optional Arguments + +None. diff --git a/roles/redis/tasks/main.yaml b/roles/redis/tasks/main.yaml new file mode 100644 index 0000000..ad70e44 --- /dev/null +++ b/roles/redis/tasks/main.yaml @@ -0,0 +1,5 @@ +- name: Ensure redis is installed + ansible.builtin.apt: + name: + - redis + become: true