With LittleChef you will be able to get started more quickly cooking with Chef, the excelent Configuration Management System.
You may think of this like a pocket Chef. You don’t need to worry about installation, repository syncing, nor Chef Server authentication. You also won’t have to remotely edit cookbooks, or commit little changes just to test things.
Installing LittleChef to your work computer is all you need to get you started.
How it all works
In a working deployment directory, the kitchen, there is:
auth.cfg: Authentication information is neede to be able to connect to the nodes
nodes/: After recipes are run on nodes, their configuration is stored here
cookbooks/: This will be your cookbooks repository. You should put this under version control.
roles/: Where roles are defined
Whenever you apply a recipe to a node, all needed cookbooks (including dependencies) and all roles are gzipped and uploaded to that node, to the
/tmp/chef-solo/ directoy. A node.json file gets created on the fly and uploaded, and Chef Solo gets executed at the remote node, using node.json as the node configuration and the pre-installed solo.rb for Chef Solo configuration.
The result is that you can play as often with your recipes and nodes as you want, without having to worry about repositories, central servers nor anything else. Once you are satisfied with a new feature in a cookbook, you can commit the
cookbooks/ directory to your repository. LittleChef brings back sanity to cookbook development.
- Python 2.6+
- Fabric 0.9.1
All needed packages are installed by typing
sudo apt-get install python-pip python-fabric for Debian and Ubuntu
yum install python-pip fabric for RHEL and CentOS
You can install Little Chef directly from the PyPI:
pip install littlechef
Note: your distribution may have a package that also provides a
cook executable. If you have installed it, you need to remove it to avoid collisions with LittleChef’s executable.
Careful what you do with your nodes!:
A certain famous Chef: What do I always say? Anyone can cook.
Little Chef: Yeah. Anyone can, that doesn’t mean that anyone should.
cook new_deployment will create inside the current directory a few files and directories for LittleChef to be able to cook. You can create and have as many deployment directories (kitchens) as you like on your computer.
To be able to issue commands to remote nodes, you need to enter a user and a password with sudo rights.
new_deployment will have created a file named
auth.cfg. You can edit it to enter a username and password.
For convenience, there is a command that allows you to deploy chef-solo to a node using the packages from the Opscode repository:
cook node:MYNODE deploy_chef:MYDISTRO
MYDISTRO can have one of the following values for debian based distributions:
‘lucid’, ‘karmic’, ‘jaunty’, ‘hardy’, ‘sid’, ‘squeeze’, ‘lenny’
and for RHEL based distros:
Note that if you already have Chef Solo installed on your nodes, you won’t need this. Also, if you previously installed Chef using the Gem procedure, please don’t try this! Installing Opscode’s packages on top of it will be a mess.
Note: The CentOS and RHEL installation method has not been tested. Feedback is welcome.
Note: Don’t cook outside of a kitchen!
cook -l: Show a list of all available orders
cook node:MYNODE recipe:MYRECIPE: Cook a recipe on a particular node by giving its hostname or IP.
nginx::source“subrecipes” are supported.
Note that the first time this is run for a node, a configuration file will be created at
nodes/myhostname.json. You can then edit this file to override recipe attributes, for example. Further runs of this command will not overwrite this configuration file.
You can force the saving of the run with
cook node:MYNODE recipe:MYRECIPE,save=True
cook node:MYNODE role:MYROLE: The same as above but role-based
cook node:all configure: It will apply all roles, recipes and attributes defined in
nodes/MYNODE.jsonto ALL nodes present in
cook node:MYNODE configure: Configures a particular pre-configured node
cook debug node:MYNODE configure: You can start all your commands with
cook debugto see all Chef Solo debbuging information
Consulting the inventory
cook list_nodes: Lists all configured nodes, showing its associated recipes, roles and attributes
cook list_nodes_with_recipe:MYRECIPE: The same as above but it only lists nodes which have associated the recipe
cook list_nodes_with_role:MYROLE: The same as above but it only lists nodes which have associated the role
cook list_recipes: Lists all available recipes, with associated information
cook list_roles: Lists all available roles, with associated information
For help regarding the use of Little Chef, or to share any ideas or suggestions you may have, please post on Little Chef’s discussion group