shortest dns configuration ever
joeyh at
I'm teaching Propellor how to configure primary DNS servers, including generating their zone files. It turns out that the complete configuration for this will look like so:
& Dns.primary hosts "olduse.net"
( Dns.mkSOA "ns1.kitenet.net" 100
[ NS (AbsDomain "ns1.kitenet.net")
, MX 0 (AbsDomain "kitenet.net")
]
)
Where are the IP addresses, you may be wondering? Surely that config should say what the address of olduse.net is, and probably also include some subdomains.
No :) Propellor has a neater way. The addresses and subdomains are configured as properties of the hosts that constitute the domain.
, host "branchable.com"
& ipv4 "66.228.46.55"
& cname "olduse.net" -- not really a CNAME, but I have not found a better word
, host "diatom.kitenet.net"
& ipv4 "107.170.31.195"
& JoeySites.oldUseNetServer hosts
`requires` cname "nntp.olduse.net"
I did not write this expecting to be able to leave out the SOA addresses like that. It just happened. A very happy accident.
David Thompson, Mark Jaroski, Olivier Mehani likes this.
Olivier Mehani shared this.
I suppose I could move the MX and even the NS from the SOA into the host's properties too, if I wanted to.
Also, the serial number for the zone file auto-increments based on the depth of git log
:)
Claes Wallin (韋嘉誠) likes this.
This also means that whenever propellor knows about a host's ssh pubkey, which it often does, it can toss in a SSHFP record, for free!
Claes Wallin (韋嘉誠), Olivier Mehani likes this.