Created
May 25, 2012 07:20
-
-
Save tknerr/2786374 to your computer and use it in GitHub Desktop.
Camp 2012 Chef Demo
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
Preparation | |
=========== | |
# preparation - start with clean environment | |
vagrant destroy chef_server -f | |
vagrant destroy c12345_svn -f | |
librarian-chef clean | |
vagrant up chef_server | |
vagrant up c12345_svn | |
Scenario | |
======== | |
we need a svn server for project c12345 - NOW! | |
Development Phase | |
================= | |
# check out the subversion recipe | |
git clone git://192.168.90.153/rmu/camp2012-cookbook-subversion.git subversion | |
# test subversion recipe locally with virtualbox and chef solo | |
vagrant up | |
# take a look at databags, check if it works in browser | |
# go to http://192.168.33.12/svn/repo1, | |
# log in with hans => should not work | |
# then try /repo2 => should work | |
# modify databags, reload and test again | |
sublime_text ../../my-chef-repo/data_bags/camp-svn/subversion.json | |
vagrant provision | |
# ok, seems to work, no longer need the vm | |
vagrant destroy -f | |
Go Live Phase | |
============= | |
# edit Cheffile, add dependency to subversion recipe | |
sublime_text Cheffile | |
# pull in dependencies | |
dir cookbooks | |
librarian-chef install | |
dir cookbooks | |
# upload cookbook | |
knife cookbook upload --all | |
# oh - where is our server actually?!? | |
# ask IT center for ip / hostname | |
# 33.33.3.17 / c12345-svn | |
# check that there is nothing running yet | |
# go to http://33.33.3.17/svn/foo | |
# set up svn repositories for this host | |
mkdir data_bags\c12345-svn | |
sublime_text data_bags/c12345-svn/subversion.json | |
{ | |
"id": "subversion", | |
"repos": [ | |
{ | |
"name": "foo", | |
"rw": ["peter"] | |
} | |
] | |
} | |
# upload databag | |
knife data bag create users | |
knife data bag from file users users.json | |
knife data bag create c12345-svn | |
knife data bag from file c12345-svn subversion.json | |
knife data bag show c12345-svn subversion -Fjson | |
# Chef server has all required information - now go bootstrap the VM!!! | |
knife bootstrap 33.33.3.17 -x vagrant -P vagrant --sudo -N c12345-svn -r 'recipe[subversion::server]' -d 'ubuntu12.04-gems' | |
# check if it works | |
# go to http://33.33.3.17/svn/foo | |
# login with peter/123 => should work | |
# node is registered at chef server! | |
knife client list | |
knife node list | |
knife node show c12345-svn -Fjson | |
# or take a look at the chef-server as well | |
# go to http://33.33.3.10:4040 | |
Cleanup | |
======= | |
# cleanup | |
vagrant destroy c12345_svn -f | |
knife client delete c12345-svn --yes | |
knife node delete c12345-svn --yes | |
knife data bag delete c12345-svn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment