Fix method undefined in heredoc
This commit is contained in:
@@ -16,16 +16,19 @@ if primary.nil?
|
||||
return
|
||||
end
|
||||
|
||||
postgresql_service_name = "postgresql@#{postgresql_version}-main"
|
||||
postgresql_data_dir = "/var/lib/postgresql/#{postgresql_version}/main"
|
||||
|
||||
# TODO Replace pg.kosmos.local with private IP once available
|
||||
# via proper node attribute
|
||||
# https://gitea.kosmos.org/kosmos/chef/issues/263
|
||||
execute "set up replication" do
|
||||
command <<-EOF
|
||||
systemctl stop #{postgresql_service}
|
||||
systemctl stop #{postgresql_service_name}
|
||||
mv #{postgresql_data_dir} #{postgresql_data_dir}.old
|
||||
pg_basebackup -h pg.kosmos.local -U replication -D #{postgresql_data_dir} -R
|
||||
chown -R postgres:postgres #{postgresql_data_dir}
|
||||
systemctl start #{postgresql_service}
|
||||
systemctl start #{postgresql_service_name}
|
||||
EOF
|
||||
environment 'PGPASSWORD' => postgresql_data_bag_item['replication_password']
|
||||
sensitive true
|
||||
|
||||
Reference in New Issue
Block a user