ansible-role-postgresql/tasks/postgresql-streaming-replic...

53 lines
1.8 KiB
YAML
Raw Normal View History

---
- name: Configuration of the streaming replication
block:
- name: Create the replication user
postgresql_user:
name: '{{ psql_streaming_replication_user }}'
role_attr_flags: "REPLICATION"
password: '{{ psql_streaming_replication_pwd }}'
encrypted: yes
state: present
- name: Setup the streaming replication on the primary
postgresql_set:
name: '{{ item.name }}'
value: "{{ item.value }}"
loop: '{{ psql_streaming_replication_config }}'
#when: postgresql_streaming_replication_primary_node == '{{ ansible_fqdn }}'
2021-04-06 14:33:15 +02:00
notify: Restart postgresql
2021-04-06 14:24:13 +02:00
become: True
become_user: postgres
tags: [ 'postgresql', 'postgres', 'pg_conf', 'postgresql_replication' ]
- name: Configure the streaming replication user on deb systems
block:
- name: Configure the replication user permissions
postgresql_pg_hba:
dest: '{{ psql_conf_dir }}/pg_hba.conf'
contype: host
users: '{{ psql_streaming_replication_user }}'
address: '{{ item }}'
method: 'scram-sha-256'
state: present
2021-04-06 14:33:15 +02:00
loop: '{{ psql_streaming_replication_hosts }}'
notify: Reload postgresql
when: ansible_distribution_file_variety == "Debian"
2021-04-06 14:24:13 +02:00
tags: [ 'postgresql', 'postgres', 'pg_conf', 'pg_hba', 'postgresql_replication' ]
- name: Configure the streaming replication user on EL
block:
- name: Configure the replication user permissions
postgresql_pg_hba:
dest: '{{ psql_el_conf_dir }}/pg_hba.conf'
contype: host
users: '{{ psql_streaming_replication_user }}'
address: '{{ item }}'
method: 'scram-sha-256'
state: present
2021-04-06 14:33:15 +02:00
loop: '{{ psql_streaming_replication_hosts }}'
notify: Reload postgresql
when: ansible_distribution_file_variety == "RedHat"
tags: [ 'postgresql', 'postgres', 'pg_conf', 'pg_hba', 'postgresql_replication' ]