aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/postgres/tasks
diff options
context:
space:
mode:
authorGravatar jchristgit <[email protected]>2024-05-14 22:03:21 +0200
committerGravatar GitHub <[email protected]>2024-05-14 22:03:21 +0200
commitb3a642d5cda8b7bdbf91b60728a29aefbb755bf5 (patch)
tree5d06d3fccd461373b219d3d653eb8a8af83e4756 /ansible/roles/postgres/tasks
parentadd the task that configures host based authentication (diff)
Pleasure the style dictator (#291)
Fix warnings with argsplat in postgres role
Diffstat (limited to 'ansible/roles/postgres/tasks')
-rw-r--r--ansible/roles/postgres/tasks/main.yml19
1 files changed, 14 insertions, 5 deletions
diff --git a/ansible/roles/postgres/tasks/main.yml b/ansible/roles/postgres/tasks/main.yml
index b605093..2824a12 100644
--- a/ansible/roles/postgres/tasks/main.yml
+++ b/ansible/roles/postgres/tasks/main.yml
@@ -18,22 +18,31 @@
- role::postgres
- name: Add postgres users
- community.postgresql.postgresql_user: "{{ item }}"
- with_items: "{{ postgres_users }}"
become: true
become_user: "{{ postgres_user }}"
+ community.postgresql.postgresql_user:
+ name: "{{ item.name }}"
+ password: "{{ item.password }}"
+ state: present
+ loop_control:
+ label: "{{ item.name }}"
+ loop: "{{ postgres_users }}"
+ environment:
+ PGOPTIONS: "-c password_encryption=scram-sha-256"
tags:
- role::postgres
- name: Add postgres databases
- community.postgresql.postgresql_db: "{{ item }}"
- with_items: "{{ postgres_databases }}"
become: true
become_user: "{{ postgres_user }}"
+ community.postgresql.postgresql_db:
+ name: "{{ item.name }}"
+ owner: "{{ item.owner }}"
+ state: present
+ loop: "{{ postgres_databases }}"
tags:
- role::postgres
-
- name: Set host based authentication rules for all postgres users at once
ansible.builtin.blockinfile:
path: /etc/postgresql/{{ postgres_version }}/main/pg_hba.conf