xoxys.postgres/tasks/post_tasks.yml

54 lines
2.0 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
2019-10-26 11:53:16 +00:00
- name: Ensure postgres databases are present
postgresql_db:
name: "{{ item.name }}"
lc_collate: "{{ item.lc_collate | default('en_US.UTF-8') }}"
lc_ctype: "{{ item.lc_ctype | default('en_US.UTF-8') }}"
encoding: "{{ item.encoding | default('UTF-8') }}"
template: "{{ item.template | default('template0') }}"
2019-10-26 13:09:33 +00:00
login_host: "{{ item.login_host | default(omit) }}"
login_password: "{{ item.login_password | default(omit) }}"
2019-10-26 12:11:06 +00:00
login_user: "{{ item.login_user | default(postgres_user) }}"
login_unix_socket: "{{ item.login_unix_socket | default(omit) }}"
port: "{{ item.port | default(omit) }}"
owner: "{{ item.owner | default(omit) }}"
state: "{{ item.state | default('present') }}"
2019-10-26 13:33:13 +00:00
loop: "{{ postgres_dbs + postgres_dbs_extra }}"
2019-10-27 15:56:16 +00:00
loop_control:
label: "{{ item.name }}"
become: True
become_user: "{{ postgres_user }}"
2018-12-08 20:58:41 +00:00
- name: Ensure PostgreSQL users are present
2022-04-03 12:53:03 +00:00
environment:
PGOPTIONS: "-c password_encryption={{ postgres_password_encryption }}"
2018-12-08 20:58:41 +00:00
postgresql_user:
name: "{{ item.name }}"
2022-04-03 12:53:03 +00:00
password: "{{ item.password | default(omit) }}"
2018-12-08 20:58:41 +00:00
encrypted: "{{ item.encrypted | default('yes') }}"
priv: "{{ item.priv | default(omit) }}"
role_attr_flags: "{{ item.role_attr_flags | default(omit) }}"
db: "{{ item.db | default(omit) }}"
2019-10-26 13:09:33 +00:00
login_host: "{{ item.login_host | default(omit) }}"
2018-12-08 20:58:41 +00:00
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') }}"
loop: "{{ postgres_users + postgres_users_extra }}"
2019-10-27 15:56:16 +00:00
loop_control:
label: "{{ item.name }}"
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