Several questions regarding knife

Folks,

may I ask you to clarify the following:

  1. Is it possible to use knife to find all nodes with certain role in
    run list and change this role to another role?
  2. When I do “knife node run_list add some_node some_role” a recipe with
    name “some_role” is added to run list, not node, what do I need to add
    role and not recipe?
  3. After doing previous step command “knife node run_list remove
    some_node some_role” doesn’t remove newly added recipe with name
    "some_role", is this expected?
  4. After changing manually roles on certain nodes from “old_role” to
    "new_role" I see via "knife search node “platform_version:10.04” that
    run list is ok, but roles still mention “old_role”, why is this so?

I’m using latest chef server (11.06) and knife 10.18.0

Thanks,
Kirill.

Inline responses

On Thu, Feb 21, 2013 at 3:15 PM, Kirill Timofeev kvt@hulu.com wrote:

Folks,

may I ask you to clarify the following:

  1. Is it possible to use knife to find all nodes with certain role in run
    list and change this role to another role?

I'd suggest using knife exec scripts for automating things like that.

  1. When I do "knife node run_list add some_node some_role" a recipe with
    name "some_role" is added to run list, not node, what do I need to add role
    and not recipe?

knife node run_list add <node_name> role[<role_name>]

  1. After doing previous step command "knife node run_list remove some_node
    some_role" doesn't remove newly added recipe with name "some_role", is this
    expected?

knife node run_list remove <node_name>
recipe[<cookbook_name>::<recipe_name>]

  1. After changing manually roles on certain nodes from "old_role" to

"new_role" I see via "knife search node "platform_version:10.04" that run
list is ok, but roles still mention "old_role", why is this so?

Don't know what you mean here.

I'm using latest chef server (11.06) and knife 10.18.0

Not sure that's a good idea either...

Thanks,
Kirill.

Hope that helps.
-JL

On Thu, Feb 21, 2013 at 12:15 PM, Kirill Timofeev kvt@hulu.com wrote:

Folks,

may I ask you to clarify the following:

  1. Is it possible to use knife to find all nodes with certain role in run
    list and change this role to another role?

yes, you can use knife exec, similar to this,

http://docs.opscode.com/essentials_environments_manage.html#move-nodes-between-environments

  1. When I do "knife node run_list add some_node some_role" a recipe with
    name "some_role" is added to run list, not node, what do I need to add role
    and not recipe?

you have to use "recipe[some]" or "role[some_role]" , that explicitly
specifies whether its role or recipe
http://wiki.opscode.com/display/chef/Managing+Nodes+With+Knife#ManagingNodesWithKnife-Addtoanode'srunlist
.

  1. After doing previous step command "knife node run_list remove some_node

some_role" doesn't remove newly added recipe with name "some_role", is this
expected?
4. After changing manually roles on certain nodes from "old_role" to
"new_role" I see via "knife search node "platform_version:10.04" that run
list is ok, but roles still mention "old_role", why is this so?

did you run chef-client on those nodes after you manually updated the
runlist? roles and recipes will be updated after a successful convergence

I'm using latest chef server (11.06) and knife 10.18.0

Thanks,
Kirill.

Thanks Ranjib for information! Everything was ok after running chef-client.

On 02/21/2013 12:26 PM, Ranjib Dey wrote:

On Thu, Feb 21, 2013 at 12:15 PM, Kirill Timofeev <kvt@hulu.com
mailto:kvt@hulu.com> wrote:

Folks,

may I ask you to clarify the following:

1. Is it possible to use knife to find all nodes with certain role
in run list and change this role to another role?

yes, you can use knife exec, similar to this,

http://docs.opscode.com/essentials_environments_manage.html#move-nodes-between-environments

2. When I do "knife node run_list add some_node some_role" a
recipe with name "some_role" is added to run list, not node, what
do I need to add role and not recipe?

you have to use "recipe[some]" or "role[some_role]" , that explicitly
specifies whether its role or recipe
http://wiki.opscode.com/display/chef/Managing+Nodes+With+Knife#ManagingNodesWithKnife-Addtoanode'srunlist.

3. After doing previous step command "knife node run_list remove
some_node some_role" doesn't remove newly added recipe with name
"some_role", is this expected?
4. After changing manually roles on certain nodes from "old_role"
to "new_role" I see via "knife search node
"platform_version:10.04" that run list is ok, but roles still
mention "old_role", why is this so?

did you run chef-client on those nodes after you manually updated the
runlist? roles and recipes will be updated after a successful convergence

I'm using latest chef server (11.06) and knife 10.18.0

Thanks,
Kirill.

Thanks James, specifying roles and recipes as you advised resolved an issue.

On 02/21/2013 12:23 PM, James Light wrote:

Inline responses

On Thu, Feb 21, 2013 at 3:15 PM, Kirill Timofeev <kvt@hulu.com
mailto:kvt@hulu.com> wrote:

Folks,

may I ask you to clarify the following:

1. Is it possible to use knife to find all nodes with certain role
in run list and change this role to another role?

I'd suggest using knife exec scripts for automating things like that.

2. When I do "knife node run_list add some_node some_role" a
recipe with name "some_role" is added to run list, not node, what
do I need to add role and not recipe?

knife node run_list add <node_name> role[<role_name>]

3. After doing previous step command "knife node run_list remove
some_node some_role" doesn't remove newly added recipe with name
"some_role", is this expected?

knife node run_list remove <node_name>
recipe[<cookbook_name>::<recipe_name>]

4. After changing manually roles on certain nodes from "old_role"
to "new_role" I see via "knife search node
"platform_version:10.04" that run list is ok, but roles still
mention "old_role", why is this so?

Don't know what you mean here.

I'm using latest chef server (11.06) and knife 10.18.0

Not sure that's a good idea either...

Thanks,
Kirill.

Hope that helps.
-JL