mirror of https://gitlab.com/tildes/tildes.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
---
|
|
- name: Create database and enable access and all necessary extensions
|
|
become_user: postgres
|
|
block:
|
|
- name: Create database
|
|
community.postgresql.postgresql_db:
|
|
name: "{{ item }}"
|
|
owner: tildes
|
|
|
|
- name: Enable extensions
|
|
community.postgresql.postgresql_ext:
|
|
name: "{{ extension }}"
|
|
db: "{{ item }}"
|
|
loop: "{{ extensions }}"
|
|
# since the "outer" loop by include_tasks is already using the `item` variable,
|
|
# this will use `extension` for the loop inside here
|
|
loop_control:
|
|
loop_var: extension
|
|
|
|
- name: Add database to pg_hba.conf
|
|
community.postgresql.postgresql_pg_hba:
|
|
dest: /etc/postgresql/{{ postgresql_version }}/main/pg_hba.conf
|
|
databases: "{{ item }}"
|
|
users: tildes
|
|
contype: local
|
|
method: trust
|
|
notify:
|
|
- Reload postgresql
|
|
|
|
- name: Add database to pgbouncer.ini
|
|
become_user: root
|
|
lineinfile:
|
|
path: /etc/pgbouncer/pgbouncer.ini
|
|
line: "{{ item }} ="
|
|
insertafter: "^\\[databases\\]$"
|
|
firstmatch: true
|
|
notify:
|
|
- Reload pgbouncer
|