@ -1,6 +1,6 @@
---
- name : Check role exists
- name : Check role exists # noqa no-changed-when
become : yes
become_user : postgres
shell : "/usr/bin/psql -Atc \"SELECT count(rolname) FROM pg_roles where rolname='replicator'\"" # noqa command-instead-of-shell
@ -12,7 +12,7 @@
shell : "/usr/bin/psql -c 'CREATE ROLE replicator WITH REPLICATION LOGIN;'"
when : role_check.stdout == "0"
- name : Change password with scram-sha-256! for replicator and set password
- name : Change password with scram-sha-256! for replicator and set password # noqa no-changed-when
become : yes
become_user : postgres
shell : "/usr/bin/psql -c \"set password_encryption = 'scram-sha-256';ALTER ROLE replicator WITH PASSWORD '{{ postgres_replicator_user_password }}';\""
@ -97,13 +97,12 @@
max_wal_senders.changed or
wal_keep_size.changed
- name : Create extension pgcrypto for template1
- name : Create extension pgcrypto for template1 # noqa no-changed-when
become : yes
become_user : postgres
shell : "/usr/bin/psql template1 -c \"create extension if not exists pgcrypto;\""
ignore_errors : yes # noqa ignore-errors no-changed-when
- name : Check database replication_cron exists
- name : Check database replication_cron exists # noqa no-changed-when
become : yes
become_user : postgres
shell : "/usr/bin/psql -Atc \"SELECT count(*) FROM pg_database WHERE datname = 'replication_cron'\""
@ -115,17 +114,17 @@
shell : "/usr/bin/psql -c \"CREATE DATABASE replication_cron;\""
when : database_replication_check.stdout == "0"
- name : Create replication update schema
- name : Create replication update schema # noqa no-changed-when
become : yes
become_user : postgres
shell : "/usr/bin/psql replication_cron -c \"CREATE SCHEMA IF NOT EXISTS replication_cron;\""
- name : Create replication update table
- name : Create replication update table # noqa no-changed-when
become : yes
become_user : postgres
shell : "/usr/bin/psql replication_cron -c \"CREATE TABLE IF NOT EXISTS replication_cron.replication_cron (dt timestamp);\""
- name : Create dummy update data
- name : Create dummy update data # noqa no-changed-when
become : yes
become_user : postgres
shell : "/usr/bin/psql replication_cron -c \"INSERT INTO replication_cron.replication_cron SELECT now() WHERE NOT EXISTS (SELECT 1 from replication_cron.replication_cron);\""