A couple of weeks ago I was trying to do a
chef-deploy using the
knife ssh command from Chef and specifying the role, but was getting the following error:
chef-repo proctor$ knife ssh "role:reporting" "sudo chef-deploy" FATAL: 12 nodes found, but does not have the required attribute to establish the connection. Try setting another attribute to open the connection using --attribute.
When I tried to do a search of nodes using the
knife search command, I was getting another error:
chef-repo proctor$ knife search node role:reporting ERROR: knife encountered an unexpected error This may be a bug in the 'search' knife command or plugin Please collect the output of this command with the `-VV` option before filing a bug report. Exception: NoMethodError: undefined method `name' for #<Hash:0x007fa8d9914f40>
I could do a
knife ssh and do a
chef-deploy if I did a manual listing of the servers.
chef-repo proctor$ knife ssh -m "reportingserver.qualified.domain" "sudo chef-deploy"
I knew we had the servers setup with the chef gem at version 10.24.0, and had thought I was setup with 10.24.0 locally as well. When I double checked my local version of the chef gem I saw I was actually on 10.20.0 locally. After uninstalling the chef gem, and installing to target 10.24.0 to match the servers, everything started working as expected.
Hopefully, you encounter errors similar to the above this will save you some time, and help you learn from my problem, and serve as a notice to double check the versions of the chef gem between your local environment and your servers.