1
0
Fork 0
mirror of https://github.com/geerlingguy/ansible-role-postgresql.git synced 2024-11-11 13:50:50 -05:00
postgresql/tasks/users.yml
Emilien Escalle fc7aaeab43
Fix error when port is not the default one
If we configure another port than the default one, the check of the users fails because ansible cannot connect to postgresql. We must provide conneciton configration to this task too
2021-03-31 19:21:40 +02:00

19 lines
879 B
YAML

---
- name: Ensure PostgreSQL users are present.
postgresql_user:
name: "{{ item.name }}"
password: "{{ item.password | default(omit) }}"
login_host: "{{ item.login_host | default('localhost') }}"
login_password: "{{ item.login_password | default(omit) }}"
login_user: "{{ item.login_user | default(postgresql_user) }}"
login_unix_socket: "{{ item.login_unix_socket | default(postgresql_unix_socket_directories[0]) }}"
port: "{{ item.port | default(omit) }}"
with_items: "{{ postgresql_users }}"
no_log: "{{ postgres_users_no_log }}"
become: true
become_user: "{{ postgresql_user }}"
# See: https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
vars:
ansible_ssh_pipelining: true
environment:
PGOPTIONS: "{{ (postgresql_auth_method == 'scram-sha-256') | ternary('-c password_encryption=scram-sha-256', '') }}"