# Revision history [back]

### how to implement refreshonly for templated file

I am trying to automate the management of our bind dns zone configuration via puppet. My current approach is as follows: every zone consists of a zone file and an include file. the zone file should be template based with the serial and the include statement as configureable parameters. I would manage the include via another file resource delivered through the puppet file server.

Based on this approach I would need some kind of custom or defined type that updates the zone file, i.e. increases the serial only if the include file changes.

As far as I understand it is not possible to implement a mechanism like exec's refreshonly for defined resource types or make it behave differently on refresh?

While I was able to write a Custom type that acts only on refresh I was not able to add another resource or templated file (by using Puppet::Util::ResourceTemplate) within that custom type. Is it possible to do so? If it is, how would that look? Would it be possible to extend the existing file type with a refresh method?

I would prefer the defined type solution but am open to any other suggestions.

I am aware that there might be other approaches to automate the configuration of a dns server but I'd like to try this first.

Thank you very much Henning

### how to implement refreshonly for templated file

I am trying to automate the management of our bind dns zone configuration via puppet. My current approach is as follows: every zone consists of a zone file and an include file. the zone file should be template based with the serial and the include statement as configureable parameters. I would manage the include via another file resource delivered through the puppet file server.

Based on this approach I would need some kind of custom or defined type that updates the zone file, i.e. increases the serial only if the include file changes.

The template looks like this: My template currently looks like this:

$TTL 300S @ IN SOA dnsserver ( <%= scope.function_get_serial([@domain])%> 28800 ; Refresh 8 hours 7200 ; Retry every 2 hours 604800 ; Expire after a week 3600 ) ; ttl of 1 hour @ IN NS ns1 IN NS ns2 IN NS ns3$INCLUDE <%= @includefile %>

As far as I understand it is not possible to implement a mechanism like exec's refreshonly for defined resource types or make it behave differently on refresh?

While I was able to write a Custom type that acts only on refresh I was not able to add another resource or templated file (by using Puppet::Util::ResourceTemplate) within that custom type. Is it possible to do so? If it is, how would that look? Would it be possible to extend the existing file type with a refresh method?

I would prefer the defined type solution but am open to any other suggestions.

I am aware that there might be other approaches to automate the configuration of a dns server but I'd like to try this first.

Thank you very much Henning