Command to run only part of run list one a node


#1

Hi ,

i have 5 recipes/cookbooks added as part of a node, i want to run only 3
ina given chef-client run . how do i do it ?

Thanks
Manoj


#2

On Sep 5, 2013, at 5:23 PM, Manoj Thakkar manoj.thakkar@gmail.com wrote:

i have 5 recipes/cookbooks added as part of a node, i want to run only 3 ina given chef-client run . how do i do it ?

Set the run_list on the node to include the three cookbooks/recipes that you want to run. See http://docs.opscode.com/essentials_node_object_run_lists.html and http://docs.opscode.com/knife_node.html#run-list-add.


Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu


#3

Thanks for the help ,

The idea is that I have 5
Recipes I wanted to run on one node but also want a way where I can run 3 out of these 5 if required and not run all 5 all the time

Thanks
Manoj

Sent from my iPhone

On Sep 5, 2013, at 3:34 PM, Brad Knowles brad@shub-internet.org wrote:

On Sep 5, 2013, at 5:23 PM, Manoj Thakkar manoj.thakkar@gmail.com wrote:

i have 5 recipes/cookbooks added as part of a node, i want to run only 3 ina given chef-client run . how do i do it ?

Set the run_list on the node to include the three cookbooks/recipes that you want to run. See http://docs.opscode.com/essentials_node_object_run_lists.html and http://docs.opscode.com/knife_node.html#run-list-add.


Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu


#4

Thanks,

Nikhil Shah

On Sep 5, 2013, at 7:04 PM, Manoj manoj.thakkar@gmail.com wrote:

Thanks for the help ,

The idea is that I have 5
Recipes I wanted to run on one node but also want a way where I can run 3 out of these 5 if required and not run all 5 all the time

Thanks
Manoj

Sent from my iPhone

On Sep 5, 2013, at 3:34 PM, Brad Knowles brad@shub-internet.org wrote:

On Sep 5, 2013, at 5:23 PM, Manoj Thakkar manoj.thakkar@gmail.com wrote:

i have 5 recipes/cookbooks added as part of a node, i want to run only 3 ina given chef-client run . how do i do it ?

Set the run_list on the node to include the three cookbooks/recipes that you want to run. See http://docs.opscode.com/essentials_node_object_run_lists.html and http://docs.opscode.com/knife_node.html#run-list-add.


Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu


#5

You can probably setup roles and add all 5 recipe on one role and have 3 recipes on the second role

Thanks,

Nikhil Shah

On Sep 5, 2013, at 7:04 PM, Manoj manoj.thakkar@gmail.com wrote:

Thanks for the help ,

The idea is that I have 5
Recipes I wanted to run on one node but also want a way where I can run 3 out of these 5 if required and not run all 5 all the time

Thanks
Manoj

Sent from my iPhone

On Sep 5, 2013, at 3:34 PM, Brad Knowles brad@shub-internet.org wrote:

On Sep 5, 2013, at 5:23 PM, Manoj Thakkar manoj.thakkar@gmail.com wrote:

i have 5 recipes/cookbooks added as part of a node, i want to run only 3 ina given chef-client run . how do i do it ?

Set the run_list on the node to include the three cookbooks/recipes that you want to run. See http://docs.opscode.com/essentials_node_object_run_lists.html and http://docs.opscode.com/knife_node.html#run-list-add.


Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu


#6

But both these roles will be added to the node and will be run when I run chef-client

Sent from my iPhone

On Sep 5, 2013, at 4:17 PM, Nikhil Shah nshah@theorchard.com wrote:

You can probably setup roles and add all 5 recipe on one role and have 3 recipes on the second role

Thanks,

Nikhil Shah

On Sep 5, 2013, at 7:04 PM, Manoj manoj.thakkar@gmail.com wrote:

Thanks for the help ,

The idea is that I have 5
Recipes I wanted to run on one node but also want a way where I can run 3 out of these 5 if required and not run all 5 all the time

Thanks
Manoj

Sent from my iPhone

On Sep 5, 2013, at 3:34 PM, Brad Knowles brad@shub-internet.org wrote:

On Sep 5, 2013, at 5:23 PM, Manoj Thakkar manoj.thakkar@gmail.com wrote:

i have 5 recipes/cookbooks added as part of a node, i want to run only 3 ina given chef-client run . how do i do it ?

Set the run_list on the node to include the three cookbooks/recipes that you want to run. See http://docs.opscode.com/essentials_node_object_run_lists.html and http://docs.opscode.com/knife_node.html#run-list-add.


Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu


#7

If you want, for just one run, to use a custom run_list, you can use the -o option to chef-client:

-o RunlistItem,RunlistItem...,   Replace current run list with specified items
    --override-runlist

If this is more permanent, code whatever logic determines whether the given recipes need to run into a cookbook:

if should_run_this_recipe?
include_recipe "some_cookbook::some_recipe"
end

Out of curiosity, what’s your motivation? Are these recipes slow and you don’t want to waste the time?


Daniel DeLeo

On Thursday, September 5, 2013 at 4:35 PM, Manoj wrote:

But both these roles will be added to the node and will be run when I run chef-client

Sent from my iPhone

On Sep 5, 2013, at 4:17 PM, Nikhil Shah <nshah@theorchard.com (mailto:nshah@theorchard.com)> wrote:

You can probably setup roles and add all 5 recipe on one role and have 3 recipes on the second role

Thanks,

Nikhil Shah

On Sep 5, 2013, at 7:04 PM, Manoj <manoj.thakkar@gmail.com (mailto:manoj.thakkar@gmail.com)> wrote:

Thanks for the help ,

The idea is that I have 5
Recipes I wanted to run on one node but also want a way where I can run 3 out of these 5 if required and not run all 5 all the time

Thanks
Manoj

Sent from my iPhone

On Sep 5, 2013, at 3:34 PM, Brad Knowles <brad@shub-internet.org (mailto:brad@shub-internet.org)> wrote:

On Sep 5, 2013, at 5:23 PM, Manoj Thakkar <manoj.thakkar@gmail.com (mailto:manoj.thakkar@gmail.com)> wrote:

i have 5 recipes/cookbooks added as part of a node, i want to run only 3 ina given chef-client run . how do i do it ?

Set the run_list on the node to include the three cookbooks/recipes that you want to run. See http://docs.opscode.com/essentials_node_object_run_lists.html and http://docs.opscode.com/knife_node.html#run-list-add.


Brad Knowles <brad@shub-internet.org (mailto:brad@shub-internet.org)>
LinkedIn Profile: http://tinyurl.com/y8kpxu


#8

You would pass -r and pass either one or both roles

Thanks,

Nikhil Shah

On Sep 5, 2013, at 7:35 PM, Manoj manoj.thakkar@gmail.com wrote:

But both these roles will be added to the node and will be run when I run chef-client

Sent from my iPhone

On Sep 5, 2013, at 4:17 PM, Nikhil Shah nshah@theorchard.com wrote:

You can probably setup roles and add all 5 recipe on one role and have 3 recipes on the second role

Thanks,

Nikhil Shah

On Sep 5, 2013, at 7:04 PM, Manoj manoj.thakkar@gmail.com wrote:

Thanks for the help ,

The idea is that I have 5
Recipes I wanted to run on one node but also want a way where I can run 3 out of these 5 if required and not run all 5 all the time

Thanks
Manoj

Sent from my iPhone

On Sep 5, 2013, at 3:34 PM, Brad Knowles brad@shub-internet.org wrote:

On Sep 5, 2013, at 5:23 PM, Manoj Thakkar manoj.thakkar@gmail.com wrote:

i have 5 recipes/cookbooks added as part of a node, i want to run only 3 ina given chef-client run . how do i do it ?

Set the run_list on the node to include the three cookbooks/recipes that you want to run. See http://docs.opscode.com/essentials_node_object_run_lists.html and http://docs.opscode.com/knife_node.html#run-list-add.


Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu


#9

Thanks

The Reason is all these roles use the same recipe and are overriding variables , is there a better way to do this ?

Sent from my iPhone

On Sep 5, 2013, at 4:39 PM, Daniel DeLeo dan@kallistec.com wrote:

If you want, for just one run, to use a custom run_list, you can use the -o option to chef-client:

-o RunlistItem,RunlistItem...,   Replace current run list with specified items
    --override-runlist

If this is more permanent, code whatever logic determines whether the given recipes need to run into a cookbook:

if should_run_this_recipe?
include_recipe "some_cookbook::some_recipe"
end

Out of curiosity, what’s your motivation? Are these recipes slow and you don’t want to waste the time?


Daniel DeLeo

On Thursday, September 5, 2013 at 4:35 PM, Manoj wrote:

But both these roles will be added to the node and will be run when I run chef-client

Sent from my iPhone

On Sep 5, 2013, at 4:17 PM, Nikhil Shah nshah@theorchard.com wrote:

You can probably setup roles and add all 5 recipe on one role and have 3 recipes on the second role

Thanks,

Nikhil Shah

On Sep 5, 2013, at 7:04 PM, Manoj manoj.thakkar@gmail.com wrote:

Thanks for the help ,

The idea is that I have 5
Recipes I wanted to run on one node but also want a way where I can run 3 out of these 5 if required and not run all 5 all the time

Thanks
Manoj

Sent from my iPhone

On Sep 5, 2013, at 3:34 PM, Brad Knowles brad@shub-internet.org wrote:

On Sep 5, 2013, at 5:23 PM, Manoj Thakkar manoj.thakkar@gmail.com wrote:

i have 5 recipes/cookbooks added as part of a node, i want to run only 3 ina given chef-client run . how do i do it ?

Set the run_list on the node to include the three cookbooks/recipes that you want to run. See http://docs.opscode.com/essentials_node_object_run_lists.html and http://docs.opscode.com/knife_node.html#run-list-add.


Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu


#10

On Thursday, September 5, 2013 at 5:03 PM, Manoj wrote:

Thanks

The Reason is all these roles use the same recipe and are overriding variables , is there a better way to do this ?
Can you explain this a bit more?


Daniel DeLeo


#11

Sure,

I have a recipe for deploying war files to jboss , I use war file name and
location to download it from as a parameter in the recipe.
The idea is to override those variables using the roles.
So if i want to deploy a war file abc.war i call the abc role.

Does it make sense ? I am not sure if this is the best way to do it, even i
am not impressed with this since i have to pass the role as a parameter to
chef client every time.

Thanks
Manoj

On Fri, Sep 6, 2013 at 9:13 AM, Daniel DeLeo dan@kallistec.com wrote:

On Thursday, September 5, 2013 at 5:03 PM, Manoj wrote:

Thanks

The Reason is all these roles use the same recipe and are overriding
variables , is there a better way to do this ?

Can you explain this a bit more?


Daniel DeLeo


#12

On Friday, September 6, 2013 at 11:07 AM, Manoj Thakkar wrote:

Sure,

I have a recipe for deploying war files to jboss , I use war file name and location to download it from as a parameter in the recipe.
The idea is to override those variables using the roles.
So if i want to deploy a war file abc.war i call the abc role.

Does it make sense ? I am not sure if this is the best way to do it, even i am not impressed with this since i have to pass the role as a parameter to chef client every time.

Thanks
Manoj

You probably want to extract your recipe code to a LWRP so you can just plug the data into it. See here:

http://docs.opscode.com/lwrp_custom_provider.html

Once that’s done, you can give each app deployment its own recipe or cookbook.


Daniel DeLeo