55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
---
|
|
- name: Postgres -- Ensure that PostgreSQL is installed.
|
|
apk:
|
|
name: postgresql, postgresql-contrib, py-psycopg2
|
|
state: present
|
|
|
|
- name: Postgres -- Ensure that the database is initialised.
|
|
command:
|
|
argv:
|
|
- /etc/init.d/postgresql
|
|
- setup
|
|
creates: /var/lib/postgresql/11/data/postgresql.conf
|
|
|
|
# TODO: Take a look at the postgres configuration file before going into production.
|
|
# TODO: Take a look at pg_hba before going into production.
|
|
|
|
- name: Postgres -- Ensure that PostgreSQL is enabled and started
|
|
service:
|
|
name: postgresql
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: waiting for Postgres to become available.
|
|
wait_for:
|
|
connect_timeout: 10
|
|
delay: 5
|
|
host: localhost
|
|
port: 5432
|
|
state: started
|
|
|
|
- name: Postgres -- Ensuring that the database user {{ pleroma_db_user }} exists.
|
|
postgresql_user:
|
|
db: postgres
|
|
encrypted: yes
|
|
name: "{{ pleroma_db_user }}"
|
|
password: "{{ pleroma_db_password }}"
|
|
state: present
|
|
|
|
- name: Postgres -- Ensuring that the database {{ pleroma_db_name }} exists.
|
|
postgresql_db:
|
|
conn_limit: "20"
|
|
encoding: UTF-8
|
|
name: "{{ pleroma_db_name }}"
|
|
owner: "{{ pleroma_db_user }}"
|
|
state: present
|
|
|
|
- name: Postgres -- Ensuring the PostgreSQL extensions is added to the database.
|
|
postgresql_ext:
|
|
name: "{{ item }}"
|
|
db: "{{ pleroma_db_name }}"
|
|
state: present
|
|
loop:
|
|
- citext
|
|
- pg_trgm
|
|
- uuid-ossp
|