- From: Phil Dibowitz <
>
- To:
- Subject: [chef] Re: Re: Re: Remove recipe from role
- Date: Tue, 19 Jun 2012 12:02:40 -0700
On Tue, Jun 19, 2012 at 11:47:53AM -0700, Phil Dibowitz wrote:
>
On Tue, Jun 19, 2012 at 11:40:51AM -0700, KC Braunschweig wrote:
>
> On Mon, Jun 18, 2012 at 8:32 PM, John Dyer
>
> <
>
>
> wrote:
>
> > Hey Guys,
>
> >
>
> > I have a quick question.. so in my base role I make use of the Dynect
>
> > cookbook to set DNS on the new node. However once the node is
>
> > provisioned I
>
> > no longer need to run this recipe and would like to remove it from the
>
> > runlist. The problem is I am not seeing a way to remove a recipe from
>
> > within a nodes runlist, only remove roles entirely and recipes.... So
>
> > is
>
> > this possible or do I need to refactor things a bit and pull out the
>
> > DynEct
>
> > cookbook from the role ?
>
>
>
> The other suggestions would work to remove an item from the run_list
>
> but if I understand you correctly, your dns cookbook isn't on the
>
> run_list directly, it's in a role. So that won't work. You can remove
>
> the role, but that isn't what you want. You can edit the role to
>
> remove the recipe, but then the next time you spin up a node it won't
>
> be in the role. If the recipe is idempotent, why do you care if its
>
> removed? Typically you'd want to leave it there so that it will
>
> continue to revalidate the intended state on future chef runs.
>
>
>
> If you really do need a one-time recipe, you'd need to put it on the
>
> run_list directly (not in a role) but then I believe there's a way
>
> that you can make a recipe remove itself from the run_list so it could
>
> make itself one-time. Alternatively, there was talk about override run
>
> list and one shot recipe features a while back. I think some of that
>
> was implemented and maybe could help but I don't know the details.
>
>
KC is right, this is the wrong approach.
>
>
Instead, do something like this in default.rb:
>
>
is_provisioned = File.exists?('/var/named/.is_provisioned')
>
>
unless is_provisioned
>
include_recipe this_cookbook::provision
>
end
>
>
And then stick everything in the provision.rb and you're done.
Oh, I didn't explicitly say it, but somewhere in provision.rb you need to
create '/var/named/.is_provisioned' :)
--
Phil Dibowitz
Open Source software and tech docs Insanity Palace of Metallica
http://www.phildev.net/ http://www.ipom.com/
"Be who you are and say what you feel, because those who mind don't matter
and those who matter don't mind."
- Dr. Seuss
Attachment:
signature.asc
Description: Digital signature
Archive powered by MHonArc 2.6.16.