Skip to content

Commit

Permalink
#319 allow configurable Postgres authentication, correct local auth t…
Browse files Browse the repository at this point in the history
…o peer
  • Loading branch information
Don Sizemore committed Sep 15, 2023
1 parent 0cd9110 commit 7ec8179
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ db:
enabled: true
auth: scram-sha-256
adminpass: DVn33dsth1s
adminuser: postgres
name: dvndb
host: localhost
user: dvnuser
Expand Down
15 changes: 13 additions & 2 deletions tasks/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,20 @@
- meta: flush_handlers

- name: dataverse python installer wants to be a postgres admin
postgresql_user:
name: postgres
community.postgresql.postgresql_user:
db: postgres
login_user: '{{ db.postgres.adminuser }}'
name: '{{ db.postgres.adminuser }}'
password: '{{ db.postgres.adminpass }}'
become: true
become_user: postgres
when: db.use_rds == false

- name: create dataverse postgres database
postgresql_db:
name: '{{ db.postgres.name }}'
become: true
become_user: postgres
when: db.use_rds == false

- name: create dataverse postgres user, set permissions
Expand All @@ -125,6 +131,8 @@
name: '{{ db.postgres.user }}'
password: '{{ db.postgres.pass }}'
role_attr_flags: 'NOSUPERUSER,CREATEDB,CREATEROLE,INHERIT,LOGIN'
become: true
become_user: postgres
when: db.use_rds == false

- name: postgresql 15 requires explicit permissions on public schema
Expand All @@ -134,6 +142,9 @@
type: schema
objs: public
role: '{{ db.postgres.user }}'
become: true
become_user: postgres
when: db.use_rds == false

- ansible.builtin.import_tasks: postgres_sequential_identifiers.yml
when: dataverse.api.test_suite == true
1 change: 1 addition & 0 deletions tests/group_vars/jenkins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ db:
postgres:
enabled: true
adminpass: DVn33dsth1s
adminuser: postgres
auth: scram-sha-256
name: dvndb
host: localhost
Expand Down
1 change: 1 addition & 0 deletions tests/group_vars/memorytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ db:
postgres:
enabled: true
adminpass: DVn33dsth1s
adminuser: postgres
auth: scram-sha-256
name: dvndb
host: localhost
Expand Down
3 changes: 2 additions & 1 deletion tests/group_vars/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ build_guides: false
db:
postgres:
enabled: true
auth: trust
auth: scram-sha-256
adminuser: postgres
adminpass: DVn33dsth1s
name: vagrantdb
host: localhost
Expand Down

0 comments on commit 7ec8179

Please sign in to comment.