From dab1d03d81c538966d03fb9318a4588a9e803b44 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Sat, 24 Mar 2012 11:20:07 -0500 Subject: Allow to run directly from a git checkout (#1037) Signed-off-by: Sol Jerome --- .../Bcfg2/Server/Hostbase/templates/batchadd.tmpl | 29 +++++++ .../Server/Hostbase/templates/dhcpd.conf.head | 5 ++ src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.tmpl | 17 ++++ src/lib/Bcfg2/Server/Hostbase/templates/hosts.tmpl | 26 ++++++ .../Server/Hostbase/templates/hostsappend.tmpl | 5 ++ src/lib/Bcfg2/Server/Hostbase/templates/named.tmpl | 69 ++++++++++++++++ .../Server/Hostbase/templates/namedviews.tmpl | 92 ++++++++++++++++++++++ .../Server/Hostbase/templates/reverseappend.tmpl | 4 + .../Server/Hostbase/templates/reversesoa.tmpl | 13 +++ src/lib/Bcfg2/Server/Hostbase/templates/zone.tmpl | 18 +++++ 10 files changed, 278 insertions(+) create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/batchadd.tmpl create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.conf.head create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.tmpl create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/hosts.tmpl create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/hostsappend.tmpl create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/named.tmpl create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/namedviews.tmpl create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/reverseappend.tmpl create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/reversesoa.tmpl create mode 100644 src/lib/Bcfg2/Server/Hostbase/templates/zone.tmpl (limited to 'src/lib/Bcfg2/Server/Hostbase/templates') diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/batchadd.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/batchadd.tmpl new file mode 100644 index 000000000..74ea3c047 --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/batchadd.tmpl @@ -0,0 +1,29 @@ +#mx -> +#priority -> + +hostname -> +whatami -> +netgroup -> +security_class -> +support -> +csi -> +printq -> +dhcp -> +outbound_smtp -> +primary_user -> +administrator -> +location -> +expiration_date -> YYYY-MM-DD +comments -> + +mac_addr -> +hdwr_type -> +ip_addr -> +#ip_addr -> +cname -> +#cname -> + +#mac_addr -> +#hdwr_type -> +#ip_addr -> +#cname -> diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.conf.head b/src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.conf.head new file mode 100644 index 000000000..a3d19547e --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.conf.head @@ -0,0 +1,5 @@ +# +# dhcpd.conf +# +# Configuration file for ISC dhcpd +# diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.tmpl new file mode 100644 index 000000000..757b263cd --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/dhcpd.tmpl @@ -0,0 +1,17 @@ +# +# This file is automatically generated. +# DO NOT EDIT IT BY HAND! +# +# This file contains {{ numips }} IP addresses +# Generated on: {% now "r" %} +# + +{% include "dhcpd.conf.head" %} + +# Hosts which require special configuration options can be listed in +# host statements. If no address is specified, the address will be +# allocated dynamically (if possible), but the host-specific information +# will still come from the host declaration. + +{% for host in hosts %}host {{ host.0 }} {hardware ethernet {{ host.1 }};fixed-address {{ host.2 }};} +{% endfor %} diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/hosts.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/hosts.tmpl new file mode 100644 index 000000000..251cb5a79 --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/hosts.tmpl @@ -0,0 +1,26 @@ +############################################################################## +# MCS hosts file +# +# This file is generated automatically - DO NOT EDIT IT. +# +# Generated on: {% now "r" %} +# + +127.0.0.1 localhost.mcs.anl.gov localhost + +# This file lists hosts in these domains: +{% for domain in domain_data %}# {{ domain.0 }}: {{ domain.1 }} +{% endfor %} +# +# This file lists hosts on these networks: +# +# Network Hosts +# --------------------------------------------------------------------- +{% for octet in two_octets_data %}# {{ octet.0 }} {{octet.1 }} +{% endfor %} +# +{% for octet in three_octets_data %}# {{ octet.0 }} {{ octet.1 }} +{% endfor %} +# +# Total host interfaces (ip addresses) in this file: {{ num_ips }} + diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/hostsappend.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/hostsappend.tmpl new file mode 100644 index 000000000..00e0d5d04 --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/hostsappend.tmpl @@ -0,0 +1,5 @@ +########################################################################## +# Hosts on subnet: {{ subnet.0 }} +# total hosts: {{ subnet.1 }} +{% for ip in ips %}{{ ip.0 }} {{ ip.1 }}{% if ip.4 and not ip.3 %} # {{ ip.5 }}{% else %}{% for name in ip.2 %} {{ name }}{% endfor %}{% for cname in ip.3 %} {{ cname }}{% endfor %} # {{ ip.5 }}{% endif %} +{% endfor %} diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/named.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/named.tmpl new file mode 100644 index 000000000..03e054198 --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/named.tmpl @@ -0,0 +1,69 @@ +// This is the primary configuration file for the BIND DNS server named. +// +// Please read /usr/share/doc/bind9/README.Debian.gz for information on the +// structure of BIND configuration files in Debian, *BEFORE* you customize +// this configuration file. +// + +include "/etc/bind/named.conf.options"; + +include "/etc/bind/rndc.key"; + +// prime the server with knowledge of the root servers +zone "." { + type hint; + file "/etc/bind/db.root"; +}; + +// be authoritative for the localhost forward and reverse zones, and for +// broadcast zones as per RFC 1912 +{% for zone in zones %} +zone "{{ zone.1 }}" { + type master; + file "/etc/bind/hostbase/{{ zone.1 }}"; + notify no; + also-notify { 140.221.9.6;140.221.8.10; }; +};{% endfor %} + +zone "localhost" { + type master; + file "/etc/bind/db.local"; +}; + +zone "127.in-addr.arpa" { + type master; + file "/etc/bind/db.127"; +}; + +zone "0.in-addr.arpa" { + type master; + file "/etc/bind/db.0"; +}; + +zone "255.in-addr.arpa" { + type master; + file "/etc/bind/db.255"; +}; +{% for reverse in reverses %} +zone "{{ reverse.0 }}.in-addr.arpa" { + type master; + file "/etc/bind/hostbase/{{ reverse.0 }}.rev"; + notify no; + also-notify { 140.221.9.6;140.221.8.10; }; +};{% endfor %} + +// zone "com" { type delegation-only; }; +// zone "net" { type delegation-only; }; + +// From the release notes: +// Because many of our users are uncomfortable receiving undelegated answers +// from root or top level domains, other than a few for whom that behaviour +// has been trusted and expected for quite some length of time, we have now +// introduced the "root-delegations-only" feature which applies delegation-only +// logic to all top level domains, and to the root domain. An exception list +// should be specified, including "MUSEUM" and "DE", and any other top level +// domains from whom undelegated responses are expected and trusted. +// root-delegation-only exclude { "DE"; "MUSEUM"; }; + +include "/etc/bind/named.conf.local"; +include "/etc/bind/named.conf.static"; diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/namedviews.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/namedviews.tmpl new file mode 100644 index 000000000..52021620e --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/namedviews.tmpl @@ -0,0 +1,92 @@ +// This is the primary configuration file for the BIND DNS server named. +// +// Please read /usr/share/doc/bind9/README.Debian.gz for information on the +// structure of BIND configuration files in Debian, *BEFORE* you customize +// this configuration file. +// + +include "/etc/bind/named.conf.options"; + +include "/etc/bind/rndc.key"; + +view "internal" { + match-clients { 140.221.9.6;140.221.8.10;140.221.8.88;140.221.8.15; }; + recursion yes; + // prime the server with knowledge of the root servers + zone "." { + type hint; + file "/etc/bind/db.root"; + }; + {% for zone in zones %} + zone "{{ zone.1 }}" { + type master; + file "/etc/bind/hostbase/{{ zone.1 }}"; + notify no; + also-notify { 140.221.9.6;140.221.8.10;140.221.8.88;140.221.8.15; }; + };{% endfor %} + // be authoritative for the localhost forward and reverse zones, and for + // broadcast zones as per RFC 1912 + + zone "localhost" { + type master; + file "/etc/bind/db.local"; + }; + + zone "127.in-addr.arpa" { + type master; + file "/etc/bind/db.127"; + }; + + zone "0.in-addr.arpa" { + type master; + file "/etc/bind/db.0"; + }; + + zone "255.in-addr.arpa" { + type master; + file "/etc/bind/db.255"; + }; + {% for reverse in reverses %} + zone "{{ reverse.0 }}.in-addr.arpa" { + type master; + file "/etc/bind/hostbase/{{ reverse.0 }}.rev"; + notify no; + also-notify { 140.221.9.6;140.221.8.10;140.221.8.88; }; + };{% endfor %} + include "/etc/bind/named.conf.static"; +}; + +view "external" { + match-clients { any; }; + recursion no; + {% for zone in zones %} + zone "{{ zone.1 }}" { + type master; + file "/etc/bind/hostbase/{{ zone.1 }}.external"; + notify no; + };{% endfor %} + + {% for reverse in reverses %} + zone "{{ reverse.0 }}.in-addr.arpa" { + type master; + file "/etc/bind/hostbase/{{ reverse.0 }}.rev.external"; + notify no; + };{% endfor %} + include "/etc/bind/named.conf.static"; +}; + + +// zone "com" { type delegation-only; }; +// zone "net" { type delegation-only; }; + +// From the release notes: +// Because many of our users are uncomfortable receiving undelegated answers +// from root or top level domains, other than a few for whom that behaviour +// has been trusted and expected for quite some length of time, we have now +// introduced the "root-delegations-only" feature which applies delegation-only +// logic to all top level domains, and to the root domain. An exception list +// should be specified, including "MUSEUM" and "DE", and any other top level +// domains from whom undelegated responses are expected and trusted. +// root-delegation-only exclude { "DE"; "MUSEUM"; }; + +include "/etc/bind/named.conf.local"; diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/reverseappend.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/reverseappend.tmpl new file mode 100644 index 000000000..6ed520c98 --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/reverseappend.tmpl @@ -0,0 +1,4 @@ +{% if fileorigin %}$ORIGIN {{ fileorigin }}.in-addr.arpa.{% endif %} +$ORIGIN {{ inaddr }}.in-addr.arpa. +{% for host in hosts %}{{ host.0.3 }} PTR {{ host.1 }}. +{% endfor %} diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/reversesoa.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/reversesoa.tmpl new file mode 100644 index 000000000..d142eaf7f --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/reversesoa.tmpl @@ -0,0 +1,13 @@ +$ORIGIN . +$TTL {{ zone.8 }} +{{ inaddr }}.in-addr.arpa IN SOA {{ zone.4 }}. {{ zone.3 }} ( + {{ zone.2 }} ; serial + {{ zone.7 }} ; refresh interval + {{ zone.6 }} ; retry interval + {{ zone.5 }} ; expire interval + {{ zone.8 }} ; min ttl + ) + + {% for ns in nameservers %}NS {{ ns.0 }} + {% endfor %} + diff --git a/src/lib/Bcfg2/Server/Hostbase/templates/zone.tmpl b/src/lib/Bcfg2/Server/Hostbase/templates/zone.tmpl new file mode 100644 index 000000000..aad48d179 --- /dev/null +++ b/src/lib/Bcfg2/Server/Hostbase/templates/zone.tmpl @@ -0,0 +1,18 @@ +$ORIGIN . +$TTL {{ zone.8 }} +{{ zone.1 }}. IN SOA {{ zone.4 }}. {{ zone.3 }}. ( + {{ zone.2 }} ; serial + {{ zone.7 }} ; refresh interval + {{ zone.6 }} ; retry interval + {{ zone.5 }} ; expire interval + {{ zone.8 }} ; min ttl + ) + + {% for ns in nameservers %}NS {{ ns.0 }} + {% endfor %} + {% for a in addresses %}A {{ a.0 }} + {% endfor %} + {% for mx in mxs %}MX {{ mx.0 }} {{ mx.1 }} + {% endfor %} +$ORIGIN {{ zone.1 }}. +localhost A 127.0.0.1 -- cgit v1.2.3-1-g7c22