Fix the firewall rules and move the password env variable #167
@@ -48,10 +48,11 @@ unless primary.nil?
|
|||||||
command <<-EOF
|
command <<-EOF
|
||||||
systemctl stop #{postgresql_service}
|
systemctl stop #{postgresql_service}
|
||||||
mv #{postgresql_data_dir} #{postgresql_data_dir}.old
|
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}
|
chown -R postgres:postgres #{postgresql_data_dir}
|
||||||
systemctl start #{postgresql_service}
|
systemctl start #{postgresql_service}
|
||||||
EOF
|
EOF
|
||||||
|
environment 'PGPASSWORD' => postgresql_data_bag_item['replication_password']
|
||||||
sensitive true
|
sensitive true
|
||||||
not_if { ::File.exist? "#{postgresql_data_dir}/standby.signal" }
|
not_if { ::File.exist? "#{postgresql_data_dir}/standby.signal" }
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user