propellor-0.4.0: property-based host configuration management in haskell

Safe HaskellNone

Propellor.Property.Dns

Synopsis

Documentation

primary :: [Host] -> Domain -> SOA -> [(BindDomain, Record)] -> PropertySource

Primary dns server for a domain.

Most of the content of the zone file is configured by setting properties of hosts. For example,

 host "foo.example.com"
   & ipv4 "192.168.1.1"
   & alias "mail.exmaple.com"

Will cause that hostmame and its alias to appear in the zone file, with the configured IP address.

The [(Domain, Record)] list can be used for additional records that cannot be configured elsewhere. For example, it might contain CNAMEs pointing at hosts that propellor does not control.

secondary :: [Host] -> Domain -> PropertySource

Secondary dns server for a domain.

The primary server is determined by looking at the properties of other hosts to find which one is configured as the primary.

Note that if a host is declared to be a primary and a secondary dns server for the same domain, the primary server config always wins.

secondaryFor :: [HostName] -> [Host] -> Domain -> PropertySource

This variant is useful if the primary server does not have its DNS configured via propellor.

mkSOA :: Domain -> SerialNumber -> [Record] -> SOASource

Generates a SOA with some fairly sane numbers in it.

The Domain is the domain to use in the SOA record. Typically something like ns1.example.com. So, not the domain that this is the SOA record for.

The SerialNumber can be whatever serial number was used by the domain before propellor started managing it. Or 0 if the domain has only ever been managed by propellor.

You do not need to increment the SerialNumber when making changes! Propellor will automatically add the number of commits in the git repository to the SerialNumber.

Handy trick: You don't need to list IPAddrs in the [Record], just make some Host sets its alias to the root of domain.

writeZoneFile :: Zone -> FilePath -> IO ()Source

Write a Zone out to a to a file.

The serial number in the Zone automatically has the serialNumberOffset added to it. Also, just in case, the old serial number used in the zone file is checked, and if it is somehow larger, its succ is used.

nextSerialNumber :: Zone -> SerialNumber -> ZoneSource

Adjusts the serial number of the zone to

  • Always be larger than the serial number in the Zone record. * Always be larger than the passed SerialNumber

serialNumberOffset :: IO SerialNumberSource

Count the number of git commits made to the current branch.

genZone :: [Host] -> Domain -> SOA -> (Zone, [WarningMessage])Source

Generates a Zone for a particular Domain from the DNS properies of all hosts that propellor knows about that are in that Domain.