xoxys.postgres/tasks/post_tasks.yml

31 lines
1.1 KiB
YAML
Raw Normal View History

2018-10-15 22:07:17 +00:00
---
2018-12-08 20:58:41 +00:00
- name: Force all notified handlers to activate pg_hba.conf
meta: flush_handlers
- name: Ensure PostgreSQL users are present
postgresql_user:
name: "{{ item.name }}"
password: "{{ 'md5' + (item.password + item.name) | hash('md5') }}"
encrypted: "{{ item.encrypted | default('yes') }}"
priv: "{{ item.priv | default(omit) }}"
role_attr_flags: "{{ item.role_attr_flags | default(omit) }}"
db: "{{ item.db | default(omit) }}"
login_host: "{{ item.login_host | default('localhost') }}"
login_password: "{{ item.login_password | default(omit) }}"
login_user: "{{ item.login_user | default(postgres_user) }}"
login_unix_socket: "{{ item.login_unix_socket | default(postgres_socket_directories[0]) }}"
port: "{{ item.port | default(omit) }}"
state: "{{ item.state | default('present') }}"
no_log: True
2019-08-27 20:55:28 +00:00
loop: "{{ postgres_users }}"
2019-06-10 13:09:32 +00:00
become: True
2018-12-08 20:58:41 +00:00
become_user: "{{ postgres_user }}"
2018-10-15 22:07:17 +00:00
- name: Ensure PostgreSQL is up and running
service:
2018-10-15 22:39:52 +00:00
name: "{{ __postgres_daemon }}"
2018-10-15 22:07:17 +00:00
state: started
enabled: yes
become: True
become_user: root