- From: Jens Skott <
>
- To:
- Subject: [chef] Re: Re: Question about recipes
- Date: Mon, 5 Nov 2012 16:30:52 +0100
But if i put a action [:restart] will it restart it every time the
client parses the recipe?
If so do I have to put it in a not_if thingy to make it not restart if
there are stuff present?
Jens Skott
Tel: +46-8-5142 4396
Schibsted Centralen IT
2012/11/5 Sean OMeara
<
>:
>
TL;DR - Chef will probably do nothing on the second run.
>
>
Actual answer -
>
>
Chef will parse the recipe, compiling a "resource collection" that
>
looks something like:
>
>
[ 'package[apache]', 'file[yourconfig]', 'service[apache]' ]
>
>
Then, it will process the resources individually, in the order
>
generated by the recipe. Each resource will independently check to see
>
if it needs to take action to fix its subject through a provider,
>
potentially changing the system as it goes.
>
>
The package resource will consult the package manager to test if it
>
needs to install apache.
>
Think `if [rpm -qa | grep apache]` of `if [dpkg -L | grep apache]`
>
under the hood.
>
>
The file resource (and its cousins template, remote_file,
>
cookbook_file, etc) will take checksums in memory and against the file
>
on disk. If they differ, the one in memory wins and gets written,
>
leaving you a diff in your output. (logs, why-run, etc)
>
>
'service[apache]' will check to see if apache is running and fix it if
>
it isn't, etc.
>
>
hope that helps
>
>
-s
>
>
On Mon, Nov 5, 2012 at 9:02 AM, Jens Skott
>
<
>
>
wrote:
>
> I have a question about RPM:s and config files with chef.
>
> Im sorry if im writing a question I should find the answer to on the
>
> site but have not found any information regarding it or I could just
>
> have missed it.
>
>
>
> The question I have is. If I write a recipe that installs a RPM
>
> package trough yum, then deploys config files in specific directories
>
> and then restarts the enables and starts the service. Then have a
>
> dependency on apache recipe and does and action [:restart] on httpd
>
> service.
>
>
>
> What does the chef recipe actualy do the second time chef runs? Does
>
> it reinstalls the RPM and config files then restarts the httpd
>
> service? Or does it do a diff to see if its the same package and skip
>
> the installation and configfiles but restarts httpd?
>
>
>
> Anyone who can enlighten me or point me to a RTFM page? =)
>
>
>
> Jens Skott
>
> Tel: +46-8-5142 4396
>
> Schibsted Centralen IT
Archive powered by MHonArc 2.6.16.