|
|
@ -35,6 +35,24 @@
|
|
|
|
become: true
|
|
|
|
become: true
|
|
|
|
become_user: postgres
|
|
|
|
become_user: postgres
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get PostgreSQL server version
|
|
|
|
|
|
|
|
community.postgresql.postgresql_info:
|
|
|
|
|
|
|
|
filter: ver*
|
|
|
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
become_user: postgres
|
|
|
|
|
|
|
|
register: postgres_version
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: GRANT USAGE, CREATE PRIVILEGES ON SCHEMA public TO koji_db_server_user
|
|
|
|
|
|
|
|
community.postgresql.postgresql_privs:
|
|
|
|
|
|
|
|
db: "{{ koji_db_server_db_name }}"
|
|
|
|
|
|
|
|
privs: USAGE,CREATE
|
|
|
|
|
|
|
|
type: schema
|
|
|
|
|
|
|
|
objs: public
|
|
|
|
|
|
|
|
role: "{{ koji_db_server_user }}"
|
|
|
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
become_user: postgres
|
|
|
|
|
|
|
|
when: postgres_version.version.major >= 15
|
|
|
|
|
|
|
|
|
|
|
|
- name: Allow requests from Koji server
|
|
|
|
- name: Allow requests from Koji server
|
|
|
|
community.postgresql.postgresql_pg_hba:
|
|
|
|
community.postgresql.postgresql_pg_hba:
|
|
|
|
dest: /var/lib/pgsql/data/pg_hba.conf
|
|
|
|
dest: /var/lib/pgsql/data/pg_hba.conf
|
|
|
@ -43,4 +61,10 @@
|
|
|
|
users: "{{ koji_db_server_user }}"
|
|
|
|
users: "{{ koji_db_server_user }}"
|
|
|
|
address: "{{ koji_db_server_ip }}/32"
|
|
|
|
address: "{{ koji_db_server_ip }}/32"
|
|
|
|
method: "{{ koji_db_server_password_encryption }}"
|
|
|
|
method: "{{ koji_db_server_password_encryption }}"
|
|
|
|
notify: restart postgresql
|
|
|
|
register: pg_hba_status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Restart PostgreSQL
|
|
|
|
|
|
|
|
ansible.builtin.service:
|
|
|
|
|
|
|
|
name: postgresql
|
|
|
|
|
|
|
|
state: restarted
|
|
|
|
|
|
|
|
when: pg_hba_status.changed
|
|
|
|