provide a way to specify real cnames

This commit is contained in:
Joey Hess 2014-04-18 23:20:07 -04:00
parent b338c0a3bb
commit 8dcd8fb0bd
2 changed files with 30 additions and 16 deletions

View File

@ -27,12 +27,26 @@ import Data.List
-- | Primary dns server for a domain.
--
-- TODO: Does not yet add it to named.conf.local.
primary :: [Host] -> Domain -> SOA -> Property
primary hosts domain soa = withwarnings (check needupdate baseprop)
--
-- 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"
-- > & cname "mail.exmaple.com"
--
-- Will cause that host and its cnames to appear in the zone file.
--
-- 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.
primary :: [Host] -> Domain -> SOA -> [(BindDomain, Record)] -> Property
primary hosts domain soa rs = withwarnings (check needupdate baseprop)
`requires` Apt.serviceInstalledRunning "bind9"
`onChange` Service.reloaded "bind9"
where
(zone, warnings) = genZone hosts domain soa
(partialzone, warnings) = genZone hosts domain soa
zone = partialzone { zHosts = zHosts partialzone ++ rs }
zonefile = "/etc/bind/propellor/db." ++ domain
needupdate = (/= Just zone) <$> readZonePropellorFile zonefile
baseprop = property ("dns primary for " ++ domain) $ makeChange $ do

View File

@ -32,6 +32,7 @@ hosts :: [Host] -- * \ | | '--------'
hosts = -- (o) `
-- My laptop
[ host "darkstar.kitenet.net"
& ipv6 "2001:4830:1600:187::2" -- sixxs tunnel
& Docker.configured
& Apt.buildDep ["git-annex"] `period` Daily
@ -40,17 +41,6 @@ hosts = -- (o) `
& ipv4 "162.248.143.249"
& ipv6 "2002:5044:5531::1"
& Dns.primary hosts "olduse.net"
( Dns.mkSOA "ns1.kitenet.net" 100
( Dns.rootAddressesFrom hosts "branchable.com" )
[ NS (AbsDomain "ns1.kitenet.net")
, NS (AbsDomain "ns6.gandi.net")
, NS (AbsDomain "ns2.kitenet.net")
, MX 0 (AbsDomain "kitenet.net")
, TXT "v=spf1 a -all"
]
)
& cleanCloudAtCost
& Apt.unattendedUpgrades
& Network.ipv6to4
@ -75,6 +65,17 @@ hosts = -- (o) `
& Docker.garbageCollected `period` Daily
& Apt.installed ["git-annex", "mtr", "screen"]
& Dns.primary hosts "olduse.net"
( Dns.mkSOA "ns1.kitenet.net" 100
[ NS (AbsDomain "ns1.kitenet.net")
, NS (AbsDomain "ns6.gandi.net")
, NS (AbsDomain "ns2.kitenet.net")
, MX 0 (AbsDomain "kitenet.net")
, TXT "v=spf1 a -all"
]
)
[ (RelDomain "article", CNAME $ AbsDomain "virgil.koldfront.dk") ]
-- Orca is the main git-annex build box.
, standardSystem "orca.kitenet.net" Unstable "amd64"
& ipv4 "138.38.108.179"
@ -288,8 +289,7 @@ monsters = -- but do want to track their public keys etc.
, host "branchable.com"
& ipv4 "66.228.46.55"
& ipv6 "2600:3c03::f03c:91ff:fedf:c0e5"
& cname "olduse.net"
& cname "www.olduse.net"
& cname "git.olduse.net"
, host "virgil.koldfront.dk"
& cname "article.olduse.net"
]