source: branches/1.0/sara_cmt/templates/examples/complex_dns.cmt @ 14188

Last change on this file since 14188 was 14188, checked in by ramonb, 12 years ago
  • another example
File size: 3.5 KB
Line 
1{% load cmt_client %}
2{% noblanklines %}
3
4{% epilogue %}
5/bin/echo dummy /usr/bin/test -f /tmp//db.subdomain.example.com.manual || /bin/touch /tmp//db.subdomain.example.com.manual
6/bin/echo dummy /usr/bin/test -f /tmp//db.int.subdomain.example.com.manual || /bin/touch /tmp//db.int.subdomain.example.com.manual
7/bin/echo dummy /usr/bin/test -f /tmp//db.con.subdomain.example.com.manual || /bin/touch /tmp//db.con.subdomain.example.com.manual
8/bin/echo dummy /etc/init.d/named reload
9{% endepilogue %}
10
11{% endnoblanklines %}
12{% store '/tmp/complexdns_db.subdomain.example.com' %}
13{% noblanklines %}
14
15;
16; SVN: {{ svn_id }}
17;      {{ svn_url }}
18;
19; This file is automagically generated by CMTSARA
20;
21;             SARA - Computing and Networking Services
22; Date        : Fri 6 Jul 2012
23; Version     : {{ version }}
24; Generated   : {% now "r" %}
25;
26
27@       IN      SOA     ns1.subdomain.example.com. root.ns1.subdomain.example.com. (
28                                         {% now "YmjH" %}   ; Serial
29                                        7200            ; Refresh
30                                        600             ; Retry
31                                        604800          ; Expire
32                                        86400 )         ; Minimum
33        IN      NS      ns1.subdomain.example.com.
34        IN      NS      ns2.subdomain.example.com.
35{% endnoblanklines %}
36
37$INCLUDE db.subdomain.example.com.manual
38
39{% use Network with 'name__contains=gina' as gina_networks %}
40{% for n in gina_networks %}
41  {% assign network_query = 'network__name=' n.name %}
42  {% use interface with network_query as network_interfaces %}
43
44$ORIGIN {{ n.domain }}.
45
46  {% noblanklines %}
47  {% for iface in network_interfaces %}
48
49{{ iface.label }}       IN      A       {{ iface.ip }}
50
51    {% if iface.cnames != None %}
52      {% for cname in iface.cnames %}
53
54{{cname}}       IN      CNAME   {{ iface.label }}
55
56      {% endfor %}
57    {% endif %}
58  {% endfor %}
59  {% endnoblanklines %}
60{% endfor %}
61
62{% endstore %}
63
64{% for n in gina_networks %}
65  {% getbasenets n.name as network_basenets %}
66  {% for bnet in network_basenets %}
67
68    {% assign filename = '/tmp/complexdns_db.' bnet %}
69    {% epilogue %}
70
71/bin/echo /usr/bin/test -f {{ filename }}.manual || /bin/touch {{ filename }}.manual
72
73    {% endepilogue %}
74    {% store filename %}
75    {% noblanklines %}
76$TTL 3600
77;
78; SVN: {{ svn_id }}
79;      {{ svn_url }}
80;
81; This file is automagically generated by CMTSARA
82;
83;             SARA - Computing and Networking Services
84; Date        : Fri 6 Jul 2012
85; Version     : {{ version }}
86; Generated   : {% now "r" %}
87@       IN      SOA     ns1.subdomain.example.com. root.ns1.subdomain.example.com. (
88                                         {% now "YmjH" %}   ; Serial
89                                        7200            ; Refresh
90                                        600             ; Retry
91                                        604800          ; Expire
92                                        86400 )         ; Minimum
93        IN      NS      ns1.subdomain.example.com.
94        IN      NS      ns2.subdomain.example.com.
95{% endnoblanklines %}
96
97$INCLUDE db.{{ bnet }}.manual
98
99$ORIGIN {{ bnet|arpanize }}.
100
101    {% noblanklines %}
102    {% assign network_query = 'network__name=' n.name %}
103    {% use interface with network_query as network_interfaces %}
104    {% for iface in network_interfaces %}
105      {% if iface.ip|base_net == bnet %}
106
107{{ iface.ip|ip_last_digit }}    IN      PTR     {{ iface.label }}.{{ n.domain }}.
108
109      {% endif %}
110    {% endfor %}
111
112    {% endnoblanklines %}
113    {% endstore %}
114  {% endfor %}
115{% endfor %}
Note: See TracBrowser for help on using the repository browser.