[chef] Re: RE: Re: Ohai Chefs!


Chronological Thread 
  • From: Joe Nuspl < >
  • To:
  • Subject: [chef] Re: RE: Re: Ohai Chefs!
  • Date: Wed, 23 Jul 2014 10:57:04 -0700

Yes, that will do it.

My bind knowledge is really rusty but could your zone file contain:

$INCLUDE serial

And then do something along the lines of:

template ‘serial’ do
  action :nothing
  variables :serial => Time.new.strftime("%Y%m%d%H%M%S”)
  source ‘serial.erb’
  notifies :reload, ‘service[named]'
end

template ‘zone’ do
  …
  notifies :create, ‘template[serial]’
end

I’ve done something similar for something other than bind.

Joe

On Jul 23, 2014, at 10:24 AM, Phillip Roberts < "> > wrote:

I think because I have the serial variable as
 
:serial => Time.new.strftime("%Y%m%d%H%M%S")
 
It sees the serial change and rewrites the file. I guess what I need to figure out is a better way to do the serial so it only generates a new one when a change occurs.
 
Thanks,
 
Phillip Roberts | Sr. Linux Systems Administrator
MyBuys - Know Every Consumer
@MyBuys | LinkedIn | Facebook
 
 
From: Joe Nuspl [ ">mailto: ] 
Sent: Wednesday, July 23, 2014 1:21 PM
To:  ">
Subject: [chef] Re: Ohai Chefs!
 
This is the default behavior.  Either something in the template is causing the contents to change each run or something external is changing the file.  If you run chef-client you should see the diff on stdout.  Does that give you any clues?
 
            Joe
 


Is there a way to make a recipe only write a template file if the file doesn’t exist or if the template has changed?
 
For instance, I have a recipe that generates zone files for bind based off of a list of domains in a data bag. However, on every chef-client run, it is regenerating the file, which is also regenerating the serial number.
 
Any assistance would be appreciated.
 
Thanks,
 
Phillip Roberts | Sr. Linux Systems Administrator
MyBuys - Know Every Consumer
@MyBuys | LinkedIn | Facebook




Archive powered by MHonArc 2.6.16.

§