Robert Kaussow
8507a31cab
All checks were successful
continuous-integration/drone/push Build is passing
54 lines
2.0 KiB
YAML
54 lines
2.0 KiB
YAML
---
|
|
- name: Force all notified handlers to activate pg_hba.conf
|
|
meta: flush_handlers
|
|
|
|
- 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') }}"
|
|
login_host: "{{ item.login_host | default(omit) }}"
|
|
login_password: "{{ item.login_password | default(omit) }}"
|
|
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') }}"
|
|
loop: "{{ postgres_dbs + postgres_dbs_extra }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
become: True
|
|
become_user: "{{ postgres_user }}"
|
|
|
|
- name: Ensure PostgreSQL users are present
|
|
environment:
|
|
PGOPTIONS: "-c password_encryption={{ postgres_password_encryption }}"
|
|
postgresql_user:
|
|
name: "{{ item.name }}"
|
|
password: "{{ item.password | default(omit) }}"
|
|
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(omit) }}"
|
|
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 }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
become: True
|
|
become_user: "{{ postgres_user }}"
|
|
|
|
- name: Ensure PostgreSQL is up and running
|
|
service:
|
|
name: "{{ __postgres_daemon }}"
|
|
state: started
|
|
enabled: yes
|
|
become: True
|
|
become_user: root
|