Download and view my resume (PDF)

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

No comments:

Post a Comment