Skip to content

Instantly share code, notes, and snippets.

@kkeane
kkeane / chef_dns_zone_with_serial_number
Created May 26, 2015 01:20
Using chef to creating a DNS zone file idempotently with auto-incrementing serial numbers
# Using chef to create files with a time stamp or similar - in this case,
# the serial number in a DNS zone file - presents a problem, because the
# time stamp interferes with with idempotency. Here is a trick for solving
# this (thanks to Noah Kantrowitz for his input and suggestion!)
# The trick is to use the same template twice, once with a constant serial
# number to check for idempotency, and a second time with the "real" serial
# number. The actual serial number can be stored in an attribute.
# Initial serial number for the zone