From e8b9dbf794c00d3f9214052e331444b701bd220c Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Wed, 21 Jul 2021 17:52:06 +0200 Subject: [PATCH 1/6] Set 'daemonize=false' option --- .../tasks/extensions/replication/extension.yml | 17 ++++++++++++----- .../extensions/replication/repmgr-upgrade.yml | 8 ++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml index d79079e595..a040150fa3 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml @@ -94,18 +94,25 @@ group: postgres when: template_repmgr_conf.dest != '/etc/repmgr.conf' - # For repmgr installed from Ubuntu package additional configuration is required before repmgrd is started as daemon + # For repmgr installed from Ubuntu package additional configuration is required before repmgrd is started as daemon, + # see https://repmgr.org/docs/5.2/repmgrd-daemon.html#REPMGRD-CONFIGURATION-DEBIAN-UBUNTU - name: Extensions | repmgr | Set repmgr.conf file in /etc/default/repmgrd replace: path: /etc/default/repmgrd - regexp: "^#REPMGRD_CONF=\"/path/to/repmgr.conf\"" - replace: "REPMGRD_CONF=\"{{ repmgr.config_dir[ansible_os_family] }}/repmgr.conf\"" + regexp: ^#REPMGRD_CONF=\"/path/to/repmgr.conf\" + replace: REPMGRD_CONF=\"{{ repmgr.config_dir[ansible_os_family] }}/repmgr.conf\" - name: Extensions | repmgr | Enable repmgrd in /etc/default/repmgrd replace: path: /etc/default/repmgrd - regexp: "^[#]?REPMGRD_ENABLED=no" - replace: "REPMGRD_ENABLED=yes" + regexp: ^[#]?REPMGRD_ENABLED=no + replace: REPMGRD_ENABLED=yes + + - name: Extensions | repmgr | Set 'daemonize=false' option in /etc/default/repmgrd + lineinfile: + path: /etc/default/repmgrd + regexp: ^[#]?REPMGRD_OPTS= + line: REPMGRD_OPTS="--daemonize=false" # --- Configure primary node --- diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml index 5b180b7e1b..8768489ba6 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml @@ -68,6 +68,14 @@ module_defaults: yum: { lock_timeout: "{{ yum_lock_timeout }}" } +# Step: Update /etc/default/repmgrd +- name: repmgr for PG {{ pg_version }} | Set 'daemonize=false' option in /etc/default/repmgrd + lineinfile: + path: /etc/default/repmgrd + regexp: ^[#]?REPMGRD_OPTS= + line: REPMGRD_OPTS="--daemonize=false" + when: ansible_os_family == 'Debian' + # Step: systemctl daemon-reload # Step: Restart PostgreSQL - name: repmgr for PG {{ pg_version }} | Restart PostgreSQL service From 07255a62f6fb1a29d03ae6246e3165644160f68a Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Wed, 21 Jul 2021 17:58:27 +0200 Subject: [PATCH 2/6] Shorter test names --- .../tests/spec/postgresql/postgresql_spec.rb | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/core/src/epicli/data/common/tests/spec/postgresql/postgresql_spec.rb b/core/src/epicli/data/common/tests/spec/postgresql/postgresql_spec.rb index 7beb5c991e..76d559b8b5 100644 --- a/core/src/epicli/data/common/tests/spec/postgresql/postgresql_spec.rb +++ b/core/src/epicli/data/common/tests/spec/postgresql/postgresql_spec.rb @@ -36,7 +36,7 @@ pg_config_file_booleans = { "true": "(?:on|true|yes|1)", "false": "(?:off|false|no|0)" } def queryForCreating - describe 'Checking if it is possible to create a test schema' do + describe 'Check if it is possible to create a test schema' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'CREATE SCHEMA serverspec_test;'\"") do its(:stdout) { should match /^CREATE SCHEMA$/ } @@ -44,7 +44,7 @@ def queryForCreating end end - describe 'Checking if it is possible to create a test table' do + describe 'Check if it is possible to create a test table' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'CREATE TABLE serverspec_test.test (col varchar(20));'\"") do its(:stdout) { should match /^CREATE TABLE$/ } @@ -52,7 +52,7 @@ def queryForCreating end end - describe 'Checking if it is possible to insert values into the test table' do + describe 'Check if it is possible to insert values into the test table' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c \\\"INSERT INTO serverspec_test.test (col) values ('SUCCESS');\\\"\"") do its(:stdout) { should match /^INSERT 0 1$/ } @@ -62,7 +62,7 @@ def queryForCreating end def queryForSelecting - describe 'Checking if it is possible to select values from the test table' do + describe 'Check if it is possible to select values from the test table' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'SELECT * from serverspec_test.test;'\"") do its(:stdout) { should match /\bSUCCESS\b/ } @@ -72,7 +72,7 @@ def queryForSelecting end def queryForAlteringTable - describe 'Altering table with multiline command to verify multiline messages support' do + describe 'Alter table with multiline command to verify multiline messages support' do let(:disable_sudo) { false } describe command("su - postgres -c psql < /dev/null") do its(:exit_status) { should eq 0 } @@ -121,7 +121,7 @@ def queryForDropping end end -describe 'Checking if PostgreSQL service is running' do +describe 'Check if PostgreSQL service is running' do if os[:family] == 'redhat' describe service('postgresql-10') do it { should be_enabled } @@ -136,7 +136,7 @@ def queryForDropping end if replicated - describe 'Checking if repmgr service is running' do + describe 'Check if repmgr service is running' do if os[:family] == 'redhat' describe service('repmgr10') do it { should be_enabled } @@ -152,7 +152,7 @@ def queryForDropping end if os[:family] == 'redhat' - describe 'Checking PostgreSQL directories and config files' do + describe 'Check PostgreSQL directories and config files' do let(:disable_sudo) { false } describe file('/var/lib/pgsql/10/data') do it { should exist } @@ -175,7 +175,7 @@ def queryForDropping end end elsif os[:family] == 'ubuntu' - describe 'Checking PostgreSQL directories and config files' do + describe 'Check PostgreSQL directories and config files' do let(:disable_sudo) { false } describe file('/etc/postgresql/10/main') do it { should exist } @@ -199,7 +199,7 @@ def queryForDropping end end -describe 'Checking if the ports are open' do +describe 'Check if the ports are open' do let(:disable_sudo) { false } describe port(postgresql_default_port) do it { should be_listening } @@ -207,7 +207,7 @@ def queryForDropping end if os[:family] == 'ubuntu' - describe 'Checking if PostgreSQL is ready' do + describe 'Check if PostgreSQL is ready' do describe command("pg_isready") do its(:stdout) { should match /postgresql:#{postgresql_default_port} - accepting connections/ } its(:exit_status) { should eq 0 } @@ -215,7 +215,7 @@ def queryForDropping end end -describe 'Checking if it is possible to connect to PostgreSQL database' do +describe 'Check if it is possible to connect to PostgreSQL database' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'SELECT 2+2;'\"") do its(:stdout) { should match /4/ } @@ -234,7 +234,7 @@ def queryForDropping primary = listInventoryHosts("postgresql")[0] secondary = listInventoryHosts("postgresql")[1] - describe 'Displaying information about each registered node in the replication cluster' do + describe 'Display information about each registered node in the replication cluster' do let(:disable_sudo) { false } describe command("su - postgres -c \"repmgr -f /etc/postgresql/10/main/repmgr.conf cluster show\""), :if => os[:family] == 'ubuntu' do its(:stdout) { should match /primary.*\*.*running/ } @@ -265,7 +265,7 @@ def queryForDropping if primary.include? host_inventory['hostname'] if os[:family] == 'redhat' - describe 'Checking PostgreSQL config files for master node' do + describe 'Check PostgreSQL config files for master node' do let(:disable_sudo) { false } describe command("cat /var/lib/pgsql/10/data/postgresql-epiphany.conf | grep wal_level") do its(:stdout) { should match /^wal_level = replica/ } @@ -291,7 +291,7 @@ def queryForDropping end end elsif os[:family] == 'ubuntu' - describe 'Checking PostgreSQL config files for master node' do + describe 'Check PostgreSQL config files for master node' do let(:disable_sudo) { false } describe command("cat /etc/postgresql/10/main/postgresql-epiphany.conf | grep wal_level") do its(:stdout) { should match /^wal_level = replica/ } @@ -318,7 +318,7 @@ def queryForDropping end end - describe 'Checking the status of master node' do + describe 'Check the status of master node' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'SELECT usename, state from pg_stat_replication;'\"") do its(:stdout) { should match /\bstreaming\b/ } @@ -327,7 +327,7 @@ def queryForDropping end end - describe 'Checking recovery status of master node' do + describe 'Check recovery status of master node' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'SELECT pg_is_in_recovery();'\"") do its(:stdout) { should match /\bf\b/ } @@ -341,7 +341,7 @@ def queryForDropping elsif secondary.include? host_inventory['hostname'] if os[:family] == 'redhat' - describe 'Checking PostgreSQL files for secondary node' do + describe 'Check PostgreSQL files for secondary node' do let(:disable_sudo) { false } describe file('/var/lib/pgsql/.pgpass') do it { should exist } @@ -350,7 +350,7 @@ def queryForDropping end end elsif os[:family] == 'ubuntu' - describe 'Checking PostgreSQL files for secondary node' do + describe 'Check PostgreSQL files for secondary node' do let(:disable_sudo) { false } describe file('/var/lib/postgresql/.pgpass') do it { should exist } @@ -360,7 +360,7 @@ def queryForDropping end end - describe 'Checking the state of replica nodes' do + describe 'Check the state of replica nodes' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'SELECT status, conninfo FROM pg_stat_wal_receiver;'\"") do its(:stdout) { should match /\bstreaming\b/ } @@ -369,7 +369,7 @@ def queryForDropping end end - describe 'Checking recovery status of replica node' do + describe 'Check recovery status of replica node' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'SELECT pg_is_in_recovery();'\"") do its(:stdout) { should match /\bt\b/ } @@ -388,14 +388,14 @@ def queryForDropping if listInventoryHosts("postgresql")[0].include? host_inventory['hostname'] - describe 'Checking if PGBouncer service is running' do + describe 'Check if PGBouncer service is running' do describe service('pgbouncer') do it { should be_enabled } it { should be_running } end end - describe 'Creating a test user' do + describe 'Create a test user' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c \\\"CREATE USER #{pg_user} WITH PASSWORD '#{pg_pass}';\\\"\" 2>&1") do its(:stdout) { should match /^CREATE ROLE$/ } @@ -403,14 +403,14 @@ def queryForDropping end end - describe 'Adding user to userlist.txt' do + describe 'Add user to userlist.txt' do let(:disable_sudo) { false } describe command("echo \\\"#{pg_user}\\\" \\\"#{pg_pass}\\\" >> /etc/pgbouncer/userlist.txt && systemctl restart pgbouncer") do its(:exit_status) { should eq 0 } end end - describe 'Granting privileges on schema to user' do + describe 'Grant privileges on schema to user' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'GRANT ALL ON SCHEMA serverspec_test to #{pg_user}; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA serverspec_test to #{pg_user};'\" 2>&1") do its(:stdout) { should match /^GRANT$/ } @@ -418,7 +418,7 @@ def queryForDropping end end - describe 'Creating a test table' do + describe 'Create a test table' do let(:disable_sudo) { false } describe command("psql -h #{postgresql_host} -p #{pgbouncer_default_port} -U #{pg_user} postgres -c 'CREATE TABLE serverspec_test.pgbtest (col varchar(20));' 2>&1") do its(:stdout) { should match /^CREATE TABLE$/ } @@ -426,7 +426,7 @@ def queryForDropping end end - describe 'Inserting values into the test table' do + describe 'Insert values into the test table' do let(:disable_sudo) { false } describe command("psql -h #{postgresql_host} -p #{pgbouncer_default_port} -U #{pg_user} postgres -c \"INSERT INTO serverspec_test.pgbtest (col) values ('PGBSUCCESS');\" 2>&1") do its(:stdout) { should match /^INSERT 0 1$/ } @@ -434,7 +434,7 @@ def queryForDropping end end - describe 'Selecting values from the test table' do + describe 'Select values from the test table' do let(:disable_sudo) { false } describe command("psql -h #{postgresql_host} -p #{pgbouncer_default_port} -U #{pg_user} postgres -c 'SELECT col from serverspec_test.pgbtest;' 2>&1") do its(:stdout) { should match /\bPGBSUCCESS\b/ } @@ -446,7 +446,7 @@ def queryForDropping if replicated || (listInventoryHosts("postgresql")[0].include? host_inventory['hostname']) - describe 'Selecting values from test tables' do + describe 'Select values from test tables' do let(:disable_sudo) { false } describe command("PGPASSWORD=#{pg_pass} psql -h #{postgresql_host} -p #{postgresql_default_port} -U #{pg_user} postgres -c 'SELECT * from serverspec_test.test;' 2>&1") do its(:stdout) { should match /\bSUCCESS\b/ } @@ -468,7 +468,7 @@ def queryForDropping queryForDropping if pgbouncer_enabled - describe 'Dropping test user' do + describe 'Drop test user' do let(:disable_sudo) { false } describe command("su - postgres -c \"psql -t -c 'DROP USER #{pg_user};'\" 2>&1") do its(:stdout) { should match /^DROP ROLE$/ } @@ -484,32 +484,32 @@ def queryForDropping end if replicated && (listInventoryHosts("postgresql")[1].include? host_inventory['hostname']) - describe 'Cleaning up' do - it "Delegating drop table query to master node" do + describe 'Clean up' do + it "Delegate drop table query to master node" do Net::SSH.start(listInventoryIPs("postgresql")[0], ENV['user'], keys: [ENV['keypath']], :keys_only => true) do|ssh| result = ssh.exec!("sudo su - postgres -c \"psql -t -c 'DROP TABLE serverspec_test.test;'\" 2>&1") expect(result).to match 'DROP TABLE' end end - it "Delegating drop table query to master node", :if => pgbouncer_enabled do + it "Delegate drop table query to master node", :if => pgbouncer_enabled do Net::SSH.start(listInventoryIPs("postgresql")[0], ENV['user'], keys: [ENV['keypath']], :keys_only => true) do|ssh| result = ssh.exec!("sudo su - postgres -c \"psql -t -c 'DROP TABLE serverspec_test.pgbtest;'\" 2>&1") expect(result).to match 'DROP TABLE' end end - it "Delegating drop schema query to master node" do + it "Delegate drop schema query to master node" do Net::SSH.start(listInventoryIPs("postgresql")[0], ENV['user'], keys: [ENV['keypath']], :keys_only => true) do|ssh| result = ssh.exec!("sudo su - postgres -c \"psql -t -c 'DROP SCHEMA serverspec_test;'\" 2>&1") expect(result).to match 'DROP SCHEMA' end end - it "Delegating drop user query to master node", :if => pgbouncer_enabled do + it "Delegate drop user query to master node", :if => pgbouncer_enabled do Net::SSH.start(listInventoryIPs("postgresql")[0], ENV['user'], keys: [ENV['keypath']], :keys_only => true) do|ssh| result = ssh.exec!("sudo su - postgres -c \"psql -t -c 'DROP USER #{pg_user};'\" 2>&1") expect(result).to match 'DROP ROLE' end end - it "Removing test user from userlist.txt", :if => pgbouncer_enabled do + it "Remove test user from userlist.txt", :if => pgbouncer_enabled do Net::SSH.start(listInventoryIPs("postgresql")[0], ENV['user'], keys: [ENV['keypath']], :keys_only => true) do|ssh| result = ssh.exec!("sudo su - -c \"sed -i '/#{pg_pass}/d' /etc/pgbouncer/userlist.txt && cat /etc/pgbouncer/userlist.txt\" 2>&1") expect(result).not_to match "#{pg_pass}" From 1b4993f0316664ce6a6cb5adb5e229bc9ab5a723 Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Wed, 21 Jul 2021 18:21:03 +0200 Subject: [PATCH 3/6] Add test for 'repmgr service status' --- .../common/tests/spec/postgresql/postgresql_spec.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/epicli/data/common/tests/spec/postgresql/postgresql_spec.rb b/core/src/epicli/data/common/tests/spec/postgresql/postgresql_spec.rb index 76d559b8b5..edd5fd2833 100644 --- a/core/src/epicli/data/common/tests/spec/postgresql/postgresql_spec.rb +++ b/core/src/epicli/data/common/tests/spec/postgresql/postgresql_spec.rb @@ -236,14 +236,17 @@ def queryForDropping describe 'Display information about each registered node in the replication cluster' do let(:disable_sudo) { false } - describe command("su - postgres -c \"repmgr -f /etc/postgresql/10/main/repmgr.conf cluster show\""), :if => os[:family] == 'ubuntu' do + describe command("su - postgres -c \"repmgr cluster show\"") do its(:stdout) { should match /primary.*\*.*running/ } its(:stdout) { should match /standby.*running/ } its(:exit_status) { should eq 0 } end - describe command("su - postgres -c \"repmgr -f /etc/repmgr/10/repmgr.conf cluster show\""), :if => os[:family] == 'redhat' do - its(:stdout) { should match /primary.*\*.*running/ } - its(:stdout) { should match /standby.*running/ } + end + + describe 'Check repmgrd is running on each node in the cluster' do + let(:disable_sudo) { false } + describe command("su - postgres -c \"repmgr service status\"") do + its(:stdout) { should_not match /not running/ } its(:exit_status) { should eq 0 } end end From 64a537388a436e57a7d9fbb4e51cbf4fc835d40e Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Wed, 21 Jul 2021 18:29:09 +0200 Subject: [PATCH 4/6] Update postgres user in sudoers file --- .../extensions/replication/repmgr-upgrade.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml index 8768489ba6..66b408f65e 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml @@ -68,6 +68,21 @@ module_defaults: yum: { lock_timeout: "{{ yum_lock_timeout }}" } +- name: repmgr for PG {{ pg_version }} | Update postgres user in sudoers file + lineinfile: + path: /etc/sudoers + regexp: "^postgres ALL=\\(ALL:ALL\\) NOPASSWD:" + line: >- + postgres ALL=(ALL:ALL) NOPASSWD: + /bin/systemctl start {{ upgrade_defaults.pg.service_name[ansible_os_family] }}, + /bin/systemctl stop {{ upgrade_defaults.pg.service_name[ansible_os_family] }}, + /bin/systemctl restart {{ upgrade_defaults.pg.service_name[ansible_os_family] }}, + /bin/systemctl reload {{ upgrade_defaults.pg.service_name[ansible_os_family] }}, + /bin/systemctl start {{ upgrade_defaults.repmgr.service_name[ansible_os_family] }}, + /bin/systemctl stop {{ upgrade_defaults.repmgr.service_name[ansible_os_family] }}, + {{ upgrade_defaults.repmgr.bin_dir[ansible_os_family] }}/repmgr standby follow + validate: 'visudo -cf %s' + # Step: Update /etc/default/repmgrd - name: repmgr for PG {{ pg_version }} | Set 'daemonize=false' option in /etc/default/repmgrd lineinfile: From b426dd3a1b2f75fc0eaaec101f441ca9a8be7542 Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Thu, 22 Jul 2021 10:04:37 +0200 Subject: [PATCH 5/6] Remove 'repmgr standby follow' from sudoers --- .../postgresql/tasks/extensions/replication/extension.yml | 3 +-- .../tasks/upgrade/extensions/replication/repmgr-upgrade.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml index a040150fa3..4a86e243d1 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml @@ -18,8 +18,7 @@ /bin/systemctl restart {{ pg.service_name[ansible_os_family] }}, /bin/systemctl reload {{ pg.service_name[ansible_os_family] }}, /bin/systemctl start {{ repmgr.service_name[ansible_os_family] }}, - /bin/systemctl stop {{ repmgr.service_name[ansible_os_family] }}, - {{ repmgr.bin_dir[ansible_os_family] }}/repmgr standby follow + /bin/systemctl stop {{ repmgr.service_name[ansible_os_family] }} validate: 'visudo -cf %s' - name: Extensions | repmgr | Create super user in postgresql diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml index 66b408f65e..7ad8a40463 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/upgrade/extensions/replication/repmgr-upgrade.yml @@ -79,8 +79,7 @@ /bin/systemctl restart {{ upgrade_defaults.pg.service_name[ansible_os_family] }}, /bin/systemctl reload {{ upgrade_defaults.pg.service_name[ansible_os_family] }}, /bin/systemctl start {{ upgrade_defaults.repmgr.service_name[ansible_os_family] }}, - /bin/systemctl stop {{ upgrade_defaults.repmgr.service_name[ansible_os_family] }}, - {{ upgrade_defaults.repmgr.bin_dir[ansible_os_family] }}/repmgr standby follow + /bin/systemctl stop {{ upgrade_defaults.repmgr.service_name[ansible_os_family] }} validate: 'visudo -cf %s' # Step: Update /etc/default/repmgrd From 8cace34a3413daf21f20cb635c32950eb1375089 Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Thu, 22 Jul 2021 10:38:50 +0200 Subject: [PATCH 6/6] Remove backslashes --- .../roles/postgresql/tasks/extensions/replication/extension.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml index 4a86e243d1..b0aed2a5a1 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/postgresql/tasks/extensions/replication/extension.yml @@ -99,7 +99,7 @@ replace: path: /etc/default/repmgrd regexp: ^#REPMGRD_CONF=\"/path/to/repmgr.conf\" - replace: REPMGRD_CONF=\"{{ repmgr.config_dir[ansible_os_family] }}/repmgr.conf\" + replace: REPMGRD_CONF="{{ repmgr.config_dir[ansible_os_family] }}/repmgr.conf" - name: Extensions | repmgr | Enable repmgrd in /etc/default/repmgrd replace: