- From: Brad Knowles <
>
- To:
- Cc: Brad Knowles <
>
- Subject: [chef] Re: Modifying node run list from within a recipe?
- Date: Tue, 27 Aug 2013 11:16:15 -0500
On Aug 27, 2013, at 10:06 AM, Brad Knowles
<
>
wrote:
>
In the particular case I have, I'm converting an installation script from
>
bash to Chef, and part of what the bash script does is adding a role to the
>
run_list for the node it's running on. So, the Chef recipe(s) in question
>
would be running as a command-line over-ride for the node, possibly as part
>
of a chef-solo run, and not part of a normal chef-client run.
Ahh, it just took a bit more searching. The end result is shown at [0], but
the key elements were discovering that the class is
Chef::RunList::RunListItem (I found good examples at [1] and [2]), but the
key link is shown at [3]:
but node.run_list is a Chef::RunList
The final result being shown at [0] is:
node = Chef::Node.load('n')
node.run_list << "role[foo]"
node.save
Thanks, everyone!
[0] <
http://stackoverflow.com/a/11749480>
[1] <
http://rubydoc.info/gems/chef/11.4.4/Chef/RunList/RunListItem>
[2]
<
https://github.com/opscode/chef/blob/master/spec/unit/run_list/run_list_item_spec.rb>
[3] <
http://lists.opscode.com/sympa/arc/chef/2013-02/msg00271.html>
--
Brad Knowles
<
>
LinkedIn Profile: <
http://tinyurl.com/y8kpxu>
Archive powered by MHonArc 2.6.16.