homelab_teamcity/roles/teamcity/tasks/postgres.yml

51 lines
1.1 KiB
YAML
Raw Normal View History

2024-07-11 16:03:33 -05:00
---
- name: Update sudoers
become: yes
community.general.sudoers:
name: zoe-do-as-postgres
state: present
user: zoe
runas: postgres
commands: ALL
- name: Create teamcity PostgreSQL user
become: yes
become_user: postgres
postgresql_user:
name: teamcity
state: present
password: "{{ teamcity_psql_password }}"
role_attr_flags: CREATEDB
environment:
PGOPTIONS: "-c password_encryption=scram-sha-256"
- name: Update pg_hba conf
become: yes
postgresql_pg_hba:
contype: host
dest: /var/lib/pgsql/data/pg_hba.conf
method: scram-sha-256
address: localhost
users: teamcity
state: present
- name: Reload PostgreSQL
become: yes
systemd:
name: postgresql
state: reloaded
- name: Create teamcity PostgreSQL DB
become: yes
become_user: postgres
postgresql_db:
name: teamcity
owner: teamcity
state: present
template: template0
encoding: UTF8
lc_collate: en_US.UTF-8
lc_ctype: en_US.UTF-8
- name: Create teamcity schema
become: yes
become_user: postgres
postgresql_schema:
name: teamcity
owner: teamcity