Created
September 11, 2012 08:38
-
-
Save bryanwb/3696935 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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