I am following exact syntax but seeing some strange behavior while adding role to one of my nodes
I am running following command which should ideally add role - webserver to do_node
knife node run_list add do_node 'role[webserver]'
But instead this is what is returned:
do_node:
run_list: recipe[roles]
Also the show node command shows something gone wrong:
Run List: recipe[roles]
Roles:
My workstation is a Win7 machine & using the hosted chef. Tried multiple times but same thing. Tried verbose output which does not reveal a whole lot!
What is likely happening is that
role[webserver]
is being interpreted as a glob and is completing to the 'roles' directory in your chef directory. Thus, from knife's perspective, you've entered:
knife node run_list add do_node roles
which it upconverts to 'recipe[roles]'. Typically single quotes avoids this type of globbing, but I've seen issue crop up with mingw. You can confirm that this is the problem by trying to add a role that won't match a folder in your current directory:
knife node run_list add do_node 'role[foo]'
The best way to quote your original command depends a bit on your shell and terminal setup, but you may try the following:
knife node run_list add do_node '"role[webserver]"'
or (with double-quotes on the outside of the run list item)
knife node run_list add do_node "'role[webserver]'"
There are a number of bugs filed against this in the Chef issue tracker. Here is one: https://tickets.opscode.com/browse/CHEF-4277