Merge branch 'bugfix/160-cookbook_fixes' of kosmos/chef into master

This commit is contained in:
Greg 2020-05-16 08:53:24 +00:00
commit 82f1e9863b
2 changed files with 6 additions and 5 deletions

View File

@ -62,11 +62,11 @@ postgresql_replicas.each do |replica|
unless node.chef_environment == "development"
include_recipe "firewall"
firewall_rule "postgresql" do
firewall_rule "postgresql replica #{replica[:hostname]}" do
port 5432
protocol :tcp
command :allow
destination replica[:ipaddress]
source replica[:ipaddress]
end
end
end

View File

@ -48,10 +48,11 @@ unless primary.nil?
command <<-EOF
systemctl stop #{postgresql_service}
mv #{postgresql_data_dir} #{postgresql_data_dir}.old
PGPASSWORD=#{postgresql_data_bag_item['replication_password']} pg_basebackup -h #{primary[:ipaddress]} -U replication -D #{postgresql_data_dir} -R
pg_basebackup -h #{primary[:ipaddress]} -U replication -D #{postgresql_data_dir} -R
chown -R postgres:postgres #{postgresql_data_dir}
systemctl start #{postgresql_service}
EOF
environment 'PGPASSWORD' => postgresql_data_bag_item['replication_password']
sensitive true
not_if { ::File.exist? "#{postgresql_data_dir}/standby.signal" }
end
@ -72,11 +73,11 @@ systemctl start #{postgresql_service}
unless node.chef_environment == "development"
include_recipe "firewall"
firewall_rule "postgresql" do
firewall_rule "postgresql primary #{primary[:hostname]}" do
port 5432
protocol :tcp
command :allow
destination primary[:ipaddress]
source primary[:ipaddress]
end
end
end