Update: there is a newer, official version of razor chef broker. Please refer to this post for more details.
Project Razor is a power control, provisioning, and management application designed to deploy both bare-metal and virtual computer resources. It also provides broker plugins to integrate with third party systems. If such broker is provided as part of the policy for deployments, the broker will be used to hand off the newly deployed node to a DevOps system. Up until now, only Puppet broker was available. However, if you are already using Chef as your chosen DevOps tool, that should not prevent you from trying out Razor!
For the last week or so I been spending my evenings working on a Chef broker for Razor. It still needs a bit of work done, however, right now my broker successfully registers nodes with the Chef server.
Lets take a look at the cli usage for adding Chef broker. First, determine what brokers are available:
root@ubuntu:/opt/razor/bin# razor broker get plugins Available Broker Plugins: Plugin Description puppet PuppetLabs PuppetMaster chef OpsCode Chef
Great, chef is one of the options! Try and add one. If not sure what the parameters are, try this:
root@ubuntu:/opt/razor/bin# razor broker add [Broker] [add_broker] <-Must Provide: [The broker plugin to use.] Command help: razor broker add (options...) -p, --plugin BROKER_PLUGIN The broker plugin to use. -n, --name BROKER_NAME The name for the broker target. -d, --description DESCRIPTION A description for the broker target. -s, --servers SERVER_LIST A comma-separated list of servers for this broker target -c, --certificate CERTIFICATE Full path to the Chef server certificate file -v, --version VERSION A target broker version (used in gem install) -h, --help Display this screen.
The options for adding Chef broker differ only slighly from the ones used for Puppet broker (current documentation for it is here). The main difference is “-c” option, to add a path to the Chef server certificate. The certificate usually be found on your server in /etc/chef/validation.pem file. Make a local copy of this file so that it can be used to register a new node with the server.
Lets go ahead and add a new broker:
root@ubuntu:/opt/razor/bin# razor broker add -p chef -n Chef_2 -d Chef -s 166.78.0.179 -c /opt/razor/bin/validation.pem Name => Chef_2 Description => Chef Plugin => chef Servers => [166.78.0.179] UUID => 2B0KgW2xCleWreET16WI4p Certificate => /opt/razor/bin/validation.pem Version => Default
Associate a current policy with the new broker:
root@ubuntu:/opt/razor/bin# razor policy update 4ZtLkicLls6isgee91JCMN [Policy] [update_policy] 4ZtLkicLls6isgee91JCMN Line Number => 3 Label => precise Enabled => true Template => linux_deploy Description => Policy for deploying a Linux-based operating system. Tags => [memsize_1GiB, vmware_vm] Model Label => install_precise Broker Target => Chef_2 Currently Bound => 26 Maximum Bound => 0 Bound Counter => 27
Now, any node deployed using this policy, will be handed off to Chef server. For hand off, broker follows these steps:
- installs chef on the node
- creates basic /etc/chef/client.rb file with client settings
- creates /etc/chef/validation.pem file
- installs ohai
- calls home (registers itself with the server and provides personal details)
In it’s current form, this broker is already pretty useful! Next, I will try and provide Chef server with Razor’s custom metadata, so that there is feature parity between Puppet and Chef brokers. If you would like to try it out, checkout the working branch: https://github.com/eglute/Razor/tree/feature/master/chef_broker
-eglute
Update: there is a newer, official version of razor chef broker. Please refer to this post for more details.