summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2014-04-18 23:20:07 -0400
committerJoey Hess2014-04-18 23:20:07 -0400
commit8dcd8fb0bda98eb2bdf34ad8d9c6590c2e8a76e5 (patch)
treed49ce6f65b98ccfe0a514d98f1e72aba6444fa47
parentb338c0a3bba52849ff163803a8c748bfbc9e7c00 (diff)
provide a way to specify real cnames
-rw-r--r--Propellor/Property/Dns.hs20
-rw-r--r--config-joey.hs26
2 files changed, 30 insertions, 16 deletions
diff --git a/Propellor/Property/Dns.hs b/Propellor/Property/Dns.hs
index 4b51eebd..e4dfb199 100644
--- a/Propellor/Property/Dns.hs
+++ b/Propellor/Property/Dns.hs
@@ -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
diff --git a/config-joey.hs b/config-joey.hs
index 232e87cb..4063aa31 100644
--- a/config-joey.hs
+++ b/config-joey.hs
@@ -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
@@ -39,17 +40,6 @@ hosts = -- (o) `
, standardSystem "clam.kitenet.net" Unstable "amd64"
& 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
@@ -74,6 +64,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"
@@ -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"
]