1
0
Fork 0
forked from infra/ansible

copr-fe: unix-socket-auth for postgresql

This commit is contained in:
Pavel Raiskup 2026-05-11 21:24:32 +02:00 committed by Pavel Raiskup
commit 4a68303c36
3 changed files with 12 additions and 16 deletions

View file

@ -1,7 +1,4 @@
local coprdb copr-fe md5
host coprdb copr-fe 127.0.0.1/8 md5
host coprdb copr-fe ::1/128 md5
local coprdb postgres ident
local coprdb copr-fe peer
# TYPE DATABASE USER ADDRESS METHOD

View file

@ -15,7 +15,12 @@
when: not postgres_initialized.stat.exists
- name: Copy pg_hba.conf
ansible.builtin.copy: src="pg/pg_hba.conf" dest=/var/lib/pgsql/data/pg_hba.conf owner=postgres group=postgres mode=0600
ansible.builtin.copy:
src: "pg/pg_hba.conf"
dest: /var/lib/pgsql/data/pg_hba.conf
owner: postgres
group: postgres
mode: '0600'
notify:
- Restart postgresql
tags:
@ -52,7 +57,10 @@
become_user: postgres
- name: Create db user
postgresql_user: db="coprdb" name="copr-fe" password="{{ copr_database_password }}" role_attr_flags=SUPERUSER,NOCREATEDB,NOCREATEROLE
postgresql_user:
db: "coprdb"
name: "copr-fe"
role_attr_flags: "SUPERUSER,NOCREATEDB,NOCREATEROLE"
become: yes
become_user: postgres
@ -134,15 +142,6 @@
group: copr-fe
mode: "0600"
- name: Install pgpass file
ansible.builtin.copy:
content: |
localhost:*:coprdb:copr-fe:{{ copr_database_password }}
dest: "{{ copr_fe_homedir }}/.pgpass"
owner: copr-fe
group: copr-fe
mode: "0400"
- stat: path="{{ copr_fe_homedir }}/.psql_history"
register: history_file

View file

@ -33,7 +33,7 @@ RESALLOC_URL = "{{ backend_base_url }}/resalloc"
#USE_ALLOWED_USERS = False
#ALLOWED_USERS = ['bonnie', 'clyde']
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://copr-fe:{{ copr_database_password }}@/coprdb'
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://copr-fe@/coprdb'
# Token length, defaults to 30 (max 255)
#API_TOKEN_LENGTH = 30