Last active
December 10, 2015 03:38
-
-
Save jippi/4375608 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A Records: | |
| dns::record::a { | |
| "dns": | |
| zone => "local.officecloud.dk", | |
| data => ["192.168.1.10"]; | |
| "web": | |
| zone => "local.officecloud.dk", | |
| data => ["192.168.1.20"]; | |
| "db": | |
| zone => "local.officecloud.dk", | |
| data => ["192.168.1.25"]; | |
| "es": | |
| zone => "local.officecloud.dk", | |
| data => ["192.168.1.26"]; | |
| "proxy": | |
| zone => "local.officecloud.dk", | |
| data => ["192.168.1.30"]; | |
| } | |
| # error | |
| $x = loadyaml('/tmp/config/sites.yaml') | |
| dns::record::a { | |
| $x | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define dns::record::a ( | |
| $zone, | |
| $data, | |
| $ttl = '', | |
| $ptr = false, | |
| $host = $name ) { | |
| $alias = "${host},A,${zone}" | |
| dns::record { $alias: | |
| zone => $zone, | |
| host => $host, | |
| ttl => $ttl, | |
| data => $data | |
| } | |
| if $ptr { | |
| $ip = inline_template('<%= data.kind_of?(Array) ? data.first : data %>') | |
| $reverse_zone = inline_template('<%= ip.split(".")[0..-2].reverse.join(".") %>.IN-ADDR.ARPA') | |
| $octet = inline_template('<%= ip.split(".")[-1] %>') | |
| dns::record::ptr { $octet: | |
| zone => $reverse_zone, | |
| data => "${host}.${zone}" | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| demo: | |
| zone: "local.officecloud.dk" | |
| data: ["192.168.1.10"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment