chef & knife - use knife ssh
Example
knife ssh -x sysadmin.a -a ipaddress "chef_environment:stage" uptime
- always define the user with
-x - always give the ssh attribute
-a ipaddressfor knife to rely on the ip attributes of the search query result - the actual search query goes along standard
knife searchsyntax - remember quotes around constructed commands, in particular
sudo do_this