Knife SSH attribute not working

glenbot picture glenbot · Apr 16, 2013 · Viewed 7.8k times · Source

Im confused by the knife ssh command. According to the docs you can pass the -a flag if your node does not have a FQDN or ipaddress attribute set. Also, if you want to override those attributes. I'm running this to test knife ssh on a local VM:

  $ knife ssh "role:webserver" "sudo chef-client" -x someusername -a 192.168.14.141

The error i receive:

FATAL: 1 node found, but does not have the required attribute to establish the connection. Try setting another attribute to open the connection using --attribute.

I am running Chef 11.4.0

Answer

Tim Potter picture Tim Potter · Apr 18, 2013

The -a argument actually means the name of the attribute which contains the IP address of the node, if the node[:fqdn] or node[:ipaddress] attributes are not set.

For example I have the openstack ohai plugin installed the public IPv4 address is stored in node[:openstack][:public_ipv4] I would write the knife ssh command like:

$ knife ssh "role:webserver" "sudo chef-client" -x user -a openstack_public_ipv4

where openstack_public_ipv4 is the search attribute format to match the node[:openstack][:public_ipv4] attribute.