Crowbar uses its own opens source Chef instance. After a default installation it is not very easy to update cookbooks from your local development environment. This howto describes a more usable configuration of local crowbar environment.
Clone the crowbar git repository to a local path
git clone https://github.com/dellcloudedge/crowbar cd crowbar
Setup your development environment with the dev tool.
The crowbar dev tool needs a bash version higher than 4. Here is a blog post on how to change the default shell to a homebrew bash shell. As long as the Crowbar team did not merge my change you additionally have to change the shebang line in the dev tool.
As chef protects against replay attacks we need to sync the system time of the crowbar admin server and the local development machine. If you did not configure a working ntp configuration in the crowbar environment you have to update the time on the crowbar environment every now and then (especially in a Virtualbox environment after resume).
Get your local time
echo \'date -us \"`date -u "+%Y-%m-%d %H:%M"`\"\' 'date -us "2012-10-10 18:07"'
and set it on all nodes (from the crowbar admin machine as root)
knife ssh node:* -- 'date -us "2012-10-10 18:07"'
In order to work from your local machine we must register it as a chef-client. To do so login to your Crowbar admin server (if you followed Deployment of Openstack on a Virtualbox Multi Node Environment the server IP is 10.124.0.10) and create a devops client key (for a more detailed discussion please visit http://wiki.opscode.com/display/chef/Workstation+Setup and http://wiki.opscode.com/display/chef/Installing+Chef+Server+Manually#InstallingChefServerManually-ConfiguretheCommandLineClient.
root@admin:~# export MY_CLIENT_NAME="devops" ;knife client create $MY_CLIENT_NAME -d -a -f /tmp/$MY_CLIENT_NAME.pem Created client[devops]
Next copy your devops.pem
file from the admin machine to the local crowbar repository directory
your-laptop > mkdir .chef your-laptop > MY_CLIENT_NAME="devops"; scp crowbar@10.124.0.10:/tmp/$MY_CLIENT_NAME.pem ~/.chef/$MY_CLIENT_NAME.pem
Copy the template knife.rb file and set the server url to the correct value (if its not already merged you can find it here: https://github.com/ehaselwanter/crowbar/blob/master/.chef/knife.rb.example)
cp .chef/knife.rb.example .chef/knife.rb
copy the template .rvmrc
in place and trust it (or install the corresponding ruby) (if its not already merged you can find it here:https://github.com/ehaselwanter/crowbar/blob/master/dot-rvmrc)
cp dot-rvmrc .rvmrc rvm rvmrc trust . rvm rvmrc load
install chef with the Gemfile (if its not already merged you can find it here:https://github.com/ehaselwanter/crowbar/blob/master/Gemfile)
bundle install
finally you can work with knife from your local maschine:
$ knife status 6 minutes ago, admin.v1.cr0wbar.de, admin.v1.cr0wbar.de, 10.124.0.10, ubuntu 12.04. 4 minutes ago, dc0-ff-ee-00-00-02.v1.cr0wbar.de, dc0-ff-ee-00-00-02.v1.cr0wbar.de, 10.124.3.2, ubuntu 12.04. 4 minutes ago, dc0-ff-ee-00-00-01.v1.cr0wbar.de, dc0-ff-ee-00-00-01.v1.cr0wbar.de, 10.124.3.3, ubuntu 12.04. 3 minutes ago, dc0-ff-ee-00-00-03.v1.cr0wbar.de, dc0-ff-ee-00-00-03.v1.cr0wbar.de, 10.124.3.1, ubuntu 12.04.
Now you can do all sorts of things like uploading cookbooks, uploading or edit data_bags and roles etc. More on knife can be found here: http://wiki.opscode.com/display/chef/Knife
Interested in Cloud or Chef Trainings? Have a look at our Commandemy Trainings page. Need help migrating to the cloud? Check out Infralovers.
comments powered by Disqus