Skip to content

Instantly share code, notes, and snippets.

@martinb3
Last active April 20, 2016 16:23
Show Gist options
  • Save martinb3/bf7cacdd69456afb9b0fb6171a2de69a to your computer and use it in GitHub Desktop.
Save martinb3/bf7cacdd69456afb9b0fb6171a2de69a to your computer and use it in GitHub Desktop.
## On all servers:
knife ssh 'name:*' 'sudo chef-client’
## On environment 'foo' only:
knife ssh 'chef_environment:foo' 'sudo chef-client'
## Search Examples (use with knife ssh)
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway
knife search "platform:*" -a languages.ruby.version
knife search "platform:*" -a kernel.machine
knife search users "groups:admin" -i
knife role list
## SSH Examples
knife ssh "name:arlo*" -x root -P PASSWORD uptime
knife ssh "NOT platform:win*" -P PASSWORD ls
knife ssh "chef_environment:Helix-Uptime-VM and NOT platform:win*" \
-x root -P PASSWORD uptime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment