Created
September 11, 2013 03:57
-
-
Save ranjib/6519193 to your computer and use it in GitHub Desktop.
How to kill a chef server
This file contains 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
# | |
# Tested on | |
# fedora19 (kernel 3.10.10-200.fc19.x86_64) , | |
# ruby 2 (rbenv), chef > 11.4 , lxc-0.9.0-2.fc21.x86_64) (rawhide) | |
# comes from lxc-ruby | |
require 'lxc' | |
# monkey patches that i introduced | |
# f19 specific bugfix | |
# [core] container.ipv4 | |
# [ssh ] container.ssh, container.ssh!, container.upload! container.download! | |
# [chef] container.chef_apply_url container.chef_bootstrap container.chef_client_run container.install_chef container.execute_chef | |
require 'lxc/extension' | |
LXC.use_sudo = true | |
vm = LXC::Container.new('chef-server') | |
vm.create(:template => 'ubuntu') | |
vm.start | |
vm.ssh_user = 'ubuntu' | |
vm.ssh_password = 'ubuntu' | |
sleep 2 # dnsmasq takes some time to allocate ip | |
vm.ssh!(:command=>'sudo apt-get install -y curl') # chef installtion requires curl | |
vm.ssh!(:command=>'curl -L https://www.opscode.com/chef/install.sh | sudo bash') # install chef | |
# a chef recipe for installing chef serever | |
url = 'https://gist.github.com/ranjib/6458717/raw/2ba6d9e73d0794ccf50b7cc8f98b1ebfc7842a6e/chef_server_apply.rb' | |
# conver your container into a chef server | |
vm.chef_apply_url(url) | |
# 1) restore your chef server backup (prod, staging , whatever) | |
# 2) spawn other containers and test them | |
# now as the headline suggest, kill the chef server. | |
vm.stop | |
vm.destroy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment