I don't have a lot to say, but this is my little bit.

Monday, September 13, 2010

Useful Chef Commands

Create roles from all the .rb files in the Chef roles directory:
for file in `find /opt/chef-repo/roles/ -name "*.rb" -type f -print`; do knife role from file $file; done

Create cookbook named example_cookbook:
rake new_cookbook COOKBOOK=example_cookbook

Run `uptime` on nodes with role "ecgen":
knife ssh ‘role:ecgen’ ‘uptime’

Run `uptime` on all nodes with any role:
knife ssh ‘role:*’ ‘uptime’

Run `uptime` on nodes where the os is ‘linux’:
knife ssh ‘os:linux’ ‘uptime’

Force a chef-client check-in on all nodes:
knife ssh ‘*:*’ ‘chef-client’

Add "rada1" role to run_list on node em1.local:
knife node run_list add em1.local "role[rada1]"

List all nodes with name matching *wdsc*:
knife search node "name:*wdsc*" -r

1 comment:

  1. Casino king - Casino in Jordan - Airjordan21 Retro
    Casino real air jordan 18 retro men king buy air jordan 18 retro men red - Casino in jordan 18 white royal blue from us Jordan. Airjordan21 Retro. find air jordan 18 stockx Find all about the games, how to find air jordan 18 retro men blue equipment, accessories and gaming experience!