- From: Peter Donald <
>
- To: Chef Mailing List <
>
- Subject: [chef] Re: Re: Re: Re: Re: Re: knife search'ing for an inherited recipe?
- Date: Fri, 18 Oct 2013 17:02:30 +1100
Hi,
There is no easy way that I know of so what we do is store all the
visited recipes via snippet of code in our run list. It looks
something like the following. Then we just search on the attribute we
created
ruby_block 'get_seen_recipes' do
block do
node.override['knife_audit']['seen_recipes'] = run_context.loaded_recipes
end
action :create
end
On Fri, Oct 18, 2013 at 3:44 PM, DV
<
>
wrote:
>
Any idea how to search for recipes that were inherited due to
>
include_recipe?
>
>
>
On Mon, Oct 14, 2013 at 2:05 PM, Guy Matz
>
<
>
>
wrote:
>
>
>
> Sweet!!!
>
>
>
>
>
> On Mon, Oct 14, 2013 at 4:40 PM, Ranjib Dey
>
> <
>
>
> wrote:
>
>>
>
>> just do `knife search node "recipes:foo"`,
>
>>
>
>> chef stores all the recipes (defined in run_list directly or via roles)
>
>> into an attribute named "recipes", as part of the run list expansion.,
>
>> hence
>
>> you can search the recipes (as well as roles) attribute, they are top
>
>> level
>
>> node attributes
>
>>
>
>>
>
>>
>
>> On Mon, Oct 14, 2013 at 1:34 PM, Guy Matz
>
>> <
>
>
>> wrote:
>
>>>
>
>>> No, that didn't do the trick, if I understood you correctly:
>
>>>
>
>>> /]$ knife search node
>
>>> 'run_list:recipes\[bondage\:\:dns\]'
>
>>> 0 items found
>
>>>
>
>>> however:
>
>>>
>
>>> /]$ knife search node 'role:iad-web' | grep
>
>>> bondage::dns | wc -l
>
>>> 11
>
>>>
>
>>> /]$ knife search node 'role:auto-bonded' | grep
>
>>> bondage::dns | wc -l
>
>>> 18
>
>>>
>
>>> /]$ knife search node 'role:auto-bonded' | head
>
>>> 18 items found
>
>>>
>
>>> Node Name: iad-hadoop105.ihr
>
>>> Environment: _default
>
>>> FQDN: iad-hadoop105.ihr
>
>>> IP: 10.5.40.169
>
>>> Run List: role[base], role[hadoop], role[auto-bonded]
>
>>> Roles: sendmail-smart-host, auto-bonded, base, hadoop
>
>>> Recipes: resolver, yum, ntp, timezone, cron, chef-client, zsh,
>
>>> users::sysadmins, sudo, emacs, vim, git, build-essential, perl, python,
>
>>> screen, nscd, openssh, motd-tail, operations, logrotate::syslog,
>
>>> vmware-tools::noop, sendmail, sendmail::sendmail_smart_host,
>
>>> users::hadoop,
>
>>> bondage::dns
>
>>> Platform: centos 6.3
>
>>>
>
>>> Thanks again!
>
>>>
>
>>>
>
>>> On Mon, Oct 14, 2013 at 4:21 PM, Daniel DeLeo
>
>>> <
>
>
>>> wrote:
>
>>>>
>
>>>>
>
>>>> On Monday, October 14, 2013 at 1:19 PM, Guy Matz wrote:
>
>>>>
>
>>>> Hi! Is there a way to "knife search node" for all of the nodes that
>
>>>> have a specific recipe, regardless of which role has included the
>
>>>> recipe in
>
>>>> the run_list?
>
>>>>
>
>>>> I have a recipe called bondage::dns that is in a few roles . . . I've
>
>>>> tried this, but it didn't work:
>
>>>> knife search node 'run_list:recipe\[bondage\:\:dns\]'
>
>>>>
>
>>>> Any help would be greatly appreciated!
>
>>>>
>
>>>> Thanks,
>
>>>> Guy
>
>>>>
>
>>>> search for `recipes` with an 's'. This won't pick up recipes that get
>
>>>> run via `include_recipe`, though.
>
>>>>
>
>>>> --
>
>>>> Daniel DeLeo
>
>>>>
>
>>>
>
>>
>
>
>
>
>
>
--
>
Best regards, Dmitriy V.
--
Cheers,
Peter Donald
Archive powered by MHonArc 2.6.16.