Skip to content

Instantly share code, notes, and snippets.

@bryanwb bryanwb/gist:3696935
Created Sep 11, 2012

Embed
What would you like to do?
node "master" do
action :provision
platform MasterMind::Platform::Vagrant
# needed for aws, rackspace, etc. but not vagrant
# credentials aws_credentials_hash
definition "/home/foo/vms/Vagrantfile"
end
node "standby" do
action :provision
platform MasterMind::Platform::Vagrant
# needed for aws, rackspace, etc. but not vagrant
# credentials aws_credentials_hash
definition "/home/foo/vms/Vagrantfile"
end
ssh "fail_master" do
action :run
# ${vagrant[...]} pulls attributes from a previously executed vagrant resource,
# the one named 'master' in this case
host "${vagrant['master']['network']}"
user "vagrant"
command "sudo /etc/init.d/postgresql stop"
end
ssh "check_standby_promotion" do
action :run
host "${vagrant['standby']['network']}"
user "vagrant"
master_promoted = false
command "ps faux|grep wal" do |ok,result|
master_promoted = true if res =~ /wal sender process/
end
if master_promoted
puts "success! master postgresql promoted"
else
puts 'fail! no master promoted'
exit 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.