[chef] Re: Re: Re: RE: RE: RE: How to force convergence without bootstrapping?


Chronological Thread 
  • From: Kenneth Barry < >
  • To: " " < >
  • Cc: " " < >
  • Subject: [chef] Re: Re: Re: RE: RE: RE: How to force convergence without bootstrapping?
  • Date: Wed, 15 Oct 2014 13:07:51 -0700

Yup, I completely agree. Just wanted to make see if I could try to answer the question, regardless of the merit f the thing. 

Sometimes I ask a question, looking for answers to another question, and answering te one I ask helps me answer the other one. 

Or, yes we know it's the wrong way, yes we agree with the eat practice, and no, this is not best practice. We just want to answer to this exact question.

Is it possible to format you hard drive on boot up? Yes it is, and here is how. Is that recommended? All the times I can think of, no it's the worst idea ever. But could there be a situation when I needed/wanted to know how to do it? Sure, I am able to imagine that there could be a reason for someone to want to do it.

On Oct 15, 2014, at 12:57 PM, George Miranda < "> > wrote:

While it certainly is possible to use 'execute' resources without guards to force a command to run *every single time* you invoke chef-client, that's typically not a recommended practice and a big red flag.  Convergent infrastructure is about managing the entire state of your stack and running arbitrary commands (especially running them always) is an anti-pattern that introduces complexity down the road.  You'll probably end up needing to refactor that decision after you hit inevitable roadblocks.

One of the things I usually tell folks getting started with Chef is to take every situation that requires an 'execute' or 'script' resource and use that opportunity to re-think how a particular process is handled.  An overwhelming majority of the time, there's typically a better way to do what you're after.  You can use recipes to always run arbitrary commands and effectively turn Chef into bash++.  But you're going to lose out on all the benefits of using Configuration Management.

Hit me up directly if you'd like to pick apart your use case.


On Wed, Oct 15, 2014 at 11:57 AM, Kenneth Barry < " target="_blank"> > wrote:
Maybe he is asking for the ability to have a certain part of a recipe run every single time. Period.

I'm not sure either, but here is how youd do it.

You can put in something like an "execute" resource block (execute, by itself, is not idempotent, and will be run in its entirety, every. single. time.

Also, parts of the recipe that manually modify the attributes will run every single time (They will not be skipped), incase your wanting to update some node/ohai data each time it runs.

On Wed, Oct 15, 2014 at 11:00 AM, Kevin Keane Subscription < " target="_blank"> > wrote:

Like others, I'm not sure I understand what you are asking.

chef-client runs *every* recipe in your run list every time. It converges every recipe every time - but then it only executes the parts that need executing. If it tried to reconfigure everything on every run, you'd have a chef-client that's excruciatingly slow, and likely would break all kinds of things (such as restarting services in the middle of the day).

I have a feeling that you are trying to get chef-client to actually execute something every time?

There are two answers to that.

First of all, chef may be the wrong tool for that job. It is not a good replacement for cron or the like.


Secondly, it *can* be done. Simply have the resource depend on some condition that is never true. Or, if your goal is to run the same thing regularly, use chef to install a script into cron.


Kevin Keane

The NetTech

http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html


-----Original message-----
From: Fouts, Chris < "> >
Sent: Wednesday 15th October 2014 7:23
To: " target="_blank">
Subject: [chef] RE: RE: How to force convergence without bootstrapping?

Sorry, let me ask it differently.

 

I do the following

1.      knife bootstrap a node

2.      knife node run_list add <node> “run_list”

3.      chef-client on node, which converges the cookbooks

 

Normally, re-running chef-client on the node again will not do anything since the cookbooks have already run the first time, meaning I’ll just get an “up-to-date” message

 

My question is, how can I re-run chef-client to make it “act” like I have not done step 3 above the first time?

 

Chris

 

 

From: Nguyen, Dang [mailto: " target="_blank"> ]
Sent: Tuesday, October 14, 2014 8:12 PM
To: " target="_blank">
Subject: [chef] RE: How to force convergence without bootstrapping?

 

Assuming you've bootstrapped the node already and assigned it a role, you simply run chef client.

-----Original Message-----
From: Fouts, Chris [ "> ]
Received: Tuesday, 14 Oct 2014, 5:08PM
To: " title="This external link will open in a new window" target="_blank"> [ " target="_blank"> ]
Subject: [chef] How to force convergence without bootstrapping?

Is there a way to “force” my cookbooks to rerun without bootstrapping my nodes?

 

Chris




--

Kenneth Barry 

TuneIn | Build and Release Engineer




Archive powered by MHonArc 2.6.16.

§