Creating cookbooks and roles with out chef-server

chefknife

I want to run:

knife role create blah

I use chef-solo and don't need knife to connect to a server. I just would like to run these commands for helping me prepopulate the files quickly. Everytime I run of these commands it attempts to connect to a server.

This does not happen for

knife cookbook create blah

Double-ewe tee eff.

Update:

I've noticed this is the case for databags and environments as well. I've read elsewhere that knife is primarily intended for use with the chef-server API, but it seems ridiculous that something like this can't be done. It just needs to save the darn file.

Best Answer

A role on chef server and chef-solo are very different in how they are represented. In chef-server they're stored in a database, whereas chef-solo uses flat JSON or Ruby files.

You'd have to ask opscode why it doesn't work for the chef-solo use case, but my guess is that its just much more involved to create and upload the roles to the database so they aimed to simplify that use case.

Either way, creating roles is pretty simple in Chef-Solo. Just create the directory and the file for the role.

http://docs.opscode.com/chef_solo.html#roles

Related Topic