Changeset 12447 for trunk


Ignore:
Timestamp:
01/28/11 16:30:03 (13 years ago)
Author:
ramonb
Message:

templates/gina/dns.cmt:

  • dynamic DNS template
  • loops through all networks
  • automagicly created all relevant DNS zones
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sara_cmt/templates/gina/dns.cmt

    r12436 r12447  
    2929;
    3030
    31 {% use interface with 'network__name=gina console' as ifaces_gina_console %}
    32 {% use interface with 'network__name=gina admin' as ifaces_gina_admin %}
    33 {% use interface with 'network__name=gina productie' as ifaces_gina_productie %}
     31
     32
     33{# {% use interface with 'network__name=gina console' as ifaces_gina_console %} #}
     34{# {% use interface with 'network__name=gina admin' as ifaces_gina_admin %} #}
     35{# {% use interface with 'network__name=gina productie' as ifaces_gina_productie %} #}
    3436
    3537@       IN      SOA     ns.gina.sara.nl. root.ns.gina.sara.nl. (
     
    4345{% endnoblanklines %}
    4446
    45 $INCLUDE db.gina.sara.nl.manual
     47{% use Network with 'name__contains=gina' as gina_networks %}
     48{% for n in gina_networks %}
     49  {% assign network_query = 'network__name=' n.name %}
     50  {% use interface with network_query as network_interfaces %}
    4651
    47 $ORIGIN gina.sara.nl.
    48 {% noblanklines %}
    49 {% for iface in ifaces_gina_productie %}
     52$ORIGIN {{ n.domain }}.
     53
     54$INCLUDE db.{{ n.domain }}.manual
     55
     56  {% noblanklines %}
     57  {% for iface in network_interfaces %}
     58
    5059{{ iface.label }}       IN      A       {{ iface.ip }}
    51   {% if iface.cnames != None %}
    52     {% for cname in iface.cnames %}
     60
     61    {% if iface.cnames != None %}
     62      {% for cname in iface.cnames %}
    5363
    5464{{cname}}       IN      CNAME   {{ iface.label }}
    5565
    56     {% endfor %}
    57   {% endif %}
     66      {% endfor %}
     67    {% endif %}
     68  {% endfor %}
     69  {% endnoblanklines %}
    5870{% endfor %}
    59 {% endnoblanklines %}
    60 
    61 $ORIGIN int.gina.sara.nl.
    62 {% noblanklines %}
    63 {% for iface in ifaces_gina_admin %}
    64 {{ iface.label }}       IN      A       {{ iface.ip }}
    65   {% if iface.cnames != None %}
    66     {% for cname in iface.cnames %}
    67 
    68 {{cname}}       IN      CNAME   {{ iface.label }}
    69 
    70     {% endfor %}
    71   {% endif %}
    72 {% endfor %}
    73 {% endnoblanklines %}
    74 
    75 $ORIGIN con.gina.sara.nl.
    76 {% noblanklines %}
    77 {% for iface in ifaces_gina_console %}
    78 {{ iface.label }}       IN      A       {{ iface.ip }}
    79   {% if iface.cnames != None %}
    80     {% for cname in iface.cnames %}
    81 
    82 {{cname}}       IN      CNAME   {{ iface.label }}
    83 
    84     {% endfor %}
    85   {% endif %}
    86 {% endfor %}
    87 {% endnoblanklines %}
    8871
    8972{% endstore %}
    9073
    91 {% store '/var/tmp/test-dns/db.192.168.32' %}
    92 {% noblanklines %}
     74{% for n in gina_networks %}
     75  {% getbasenets n.name as network_basenets %}
     76  {% for bnet in network_basenets %}
     77
     78    {% assign filename = '/var/tmp/test-dns/db.' bnet %}
     79    {% store filename %}
     80    {% noblanklines %}
    9381$TTL 3600
    9482;
     
    112100{% endnoblanklines %}
    113101
    114 $INCLUDE db.192.168.32.manual
     102$ORIGIN {{ bnet|arpanize }}.
    115103
    116 $ORIGIN 32.168.192.in-addr.arpa.
    117 {% noblanklines %}
    118 {% for iface in ifaces_gina_console %}
    119   {% if iface.ip|base_net == '192.168.32' %}
     104$INCLUDE db.{{ bnet }}.manual
    120105
    121 {{ iface.ip|ip_last_digit }}    IN      PTR     {{ iface.label }}.con.gina.sara.nl.
     106    {% noblanklines %}
     107    {% assign network_query = 'network__name=' n.name %}
     108    {% use interface with network_query as network_interfaces %}
     109    {% for iface in network_interfaces %}
     110      {% if iface.ip|base_net == bnet %}
    122111
    123   {% endif %}
     112{{ iface.ip|ip_last_digit }}    IN      PTR     {{ iface.label }}.{{ n.domain }}.
     113
     114      {% endif %}
     115    {% endfor %}
     116
     117    {% endnoblanklines %}
     118    {% endstore %}
     119  {% endfor %}
    124120{% endfor %}
    125 
    126 {% endnoblanklines %}
    127 {% endstore %}
    128 
    129 {% store '/var/tmp/test-dns/db.192.168.33' %}
    130 {% noblanklines %}
    131 $TTL 3600
    132 ;
    133 ; SVN: {{ svn_id }}
    134 ;      {{ svn_url }}
    135 ;
    136 ; This file is automagically generated by CMTSARA
    137 ;
    138 ;             SARA - Computing and Networking Services
    139 ; Date        : Jan 24 2011
    140 ; Version     : {{ version }}
    141 ; Generated   : {% now "r" %}
    142 @       IN      SOA     ns.gina.sara.nl. root.ns.gina.sara.nl. (
    143                                          {% now "YmjH" %}   ; Serial
    144                                         7200            ; Refresh
    145                                         600             ; Retry
    146                                         604800          ; Expire
    147                                         86400 )         ; Minimum
    148         IN      NS      ns.gina.sara.nl.
    149         IN      NS      ns2.gina.sara.nl.
    150 {% endnoblanklines %}
    151 
    152 $INCLUDE db.192.168.33.manual
    153 
    154 $ORIGIN 33.168.192.in-addr.arpa.
    155 {% noblanklines %}
    156 {% for iface in ifaces_gina_console %}
    157   {% if iface.ip|base_net == '192.168.33' %}
    158 
    159 {{ iface.ip|ip_last_digit }}    IN      PTR     {{ iface.label }}.con.gina.sara.nl.
    160 
    161   {% endif %}
    162 {% endfor %}
    163 
    164 {% endnoblanklines %}
    165 {% endstore %}
    166 
    167 {% store '/var/tmp/test-dns/db.192.168.20' %}
    168 {% noblanklines %}
    169 $TTL 3600
    170 ;
    171 ; SVN: {{ svn_id }}
    172 ;      {{ svn_url }}
    173 ;
    174 ; This file is automagically generated by CMTSARA
    175 ;
    176 ;             SARA - Computing and Networking Services
    177 ; Date        : Jan 24 2011
    178 ; Version     : {{ version }}
    179 ; Generated   : {% now "r" %}
    180 @       IN      SOA     ns.gina.sara.nl. root.ns.gina.sara.nl. (
    181                                          {% now "YmjH" %}   ; Serial
    182                                         7200            ; Refresh
    183                                         600             ; Retry
    184                                         604800          ; Expire
    185                                         86400 )         ; Minimum
    186         IN      NS      ns.gina.sara.nl.
    187         IN      NS      ns2.gina.sara.nl.
    188 {% endnoblanklines %}
    189 
    190 $INCLUDE db.192.168.20.manual
    191 
    192 $ORIGIN 20.168.192.in-addr.arpa.
    193 {% noblanklines %}
    194 {% for iface in ifaces_gina_admin %}
    195   {% if iface.ip|base_net == '192.168.20' %}
    196 
    197 {{ iface.ip|ip_last_digit }}    IN      PTR     {{ iface.label }}.int.gina.sara.nl.
    198 
    199   {% endif %}
    200 {% endfor %}
    201 
    202 {% endnoblanklines %}
    203 {% endstore %}
    204 
    205 {% store '/var/tmp/test-dns/db.192.168.21' %}
    206 {% noblanklines %}
    207 $TTL 3600
    208 ;
    209 ; SVN: {{ svn_id }}
    210 ;      {{ svn_url }}
    211 ;
    212 ; This file is automagically generated by CMTSARA
    213 ;
    214 ;             SARA - Computing and Networking Services
    215 ; Date        : Jan 24 2011
    216 ; Version     : {{ version }}
    217 ; Generated   : {% now "r" %}
    218 @       IN      SOA     ns.gina.sara.nl. root.ns.gina.sara.nl. (
    219                                          {% now "YmjH" %}   ; Serial
    220                                         7200            ; Refresh
    221                                         600             ; Retry
    222                                         604800          ; Expire
    223                                         86400 )         ; Minimum
    224         IN      NS      ns.gina.sara.nl.
    225         IN      NS      ns2.gina.sara.nl.
    226 {% endnoblanklines %}
    227 
    228 $INCLUDE db.192.168.21.manual
    229 
    230 $ORIGIN 21.168.192.in-addr.arpa.
    231 {% noblanklines %}
    232 {% for iface in ifaces_gina_admin %}
    233   {% if iface.ip|base_net == '192.168.21' %}
    234 
    235 {{ iface.ip|ip_last_digit }}    IN      PTR     {{ iface.label }}.int.gina.sara.nl.
    236 
    237   {% endif %}
    238 {% endfor %}
    239 
    240 {% endnoblanklines %}
    241 {% endstore %}
    242 
    243 {% store '/var/tmp/test-dns/db.145.100.48' %}
    244 {% noblanklines %}
    245 $TTL 3600
    246 ;
    247 ; SVN: {{ svn_id }}
    248 ;      {{ svn_url }}
    249 ;
    250 ; This file is automagically generated by CMTSARA
    251 ;
    252 ;             SARA - Computing and Networking Services
    253 ; Date        : Jan 24 2011
    254 ; Version     : {{ version }}
    255 ; Generated   : {% now "r" %}
    256 @       IN      SOA     ns.gina.sara.nl. root.ns.gina.sara.nl. (
    257                                          {% now "YmjH" %}   ; Serial
    258                                         7200            ; Refresh
    259                                         600             ; Retry
    260                                         604800          ; Expire
    261                                         86400 )         ; Minimum
    262         IN      NS      ns.gina.sara.nl.
    263         IN      NS      ns2.gina.sara.nl.
    264 {% endnoblanklines %}
    265 
    266 $INCLUDE db.145.100.48.manual
    267 
    268 $ORIGIN 48.100.145.in-addr.arpa.
    269 {% noblanklines %}
    270 {% for iface in ifaces_gina_productie %}
    271   {% if iface.ip|base_net == '145.100.48' %}
    272 
    273 {{ iface.ip|ip_last_digit }}    IN      PTR     {{ iface.label }}.gina.sara.nl.
    274 
    275   {% endif %}
    276 {% endfor %}
    277 
    278 {% endnoblanklines %}
    279 {% endstore %}
    280 
    281 {% store '/var/tmp/test-dns/db.145.100.49' %}
    282 {% noblanklines %}
    283 $TTL 3600
    284 ;
    285 ; SVN: {{ svn_id }}
    286 ;      {{ svn_url }}
    287 ;
    288 ; This file is automagically generated by CMTSARA
    289 ;
    290 ;             SARA - Computing and Networking Services
    291 ; Date        : Jan 24 2011
    292 ; Version     : {{ version }}
    293 ; Generated   : {% now "r" %}
    294 @       IN      SOA     ns.gina.sara.nl. root.ns.gina.sara.nl. (
    295                                          {% now "YmjH" %}   ; Serial
    296                                         7200            ; Refresh
    297                                         600             ; Retry
    298                                         604800          ; Expire
    299                                         86400 )         ; Minimum
    300         IN      NS      ns.gina.sara.nl.
    301         IN      NS      ns2.gina.sara.nl.
    302 {% endnoblanklines %}
    303 
    304 $INCLUDE db.145.100.49.manual
    305 
    306 $ORIGIN 49.100.145.in-addr.arpa.
    307 {% noblanklines %}
    308 {% for iface in ifaces_gina_productie %}
    309   {% if iface.ip|base_net == '145.100.40' %}
    310 
    311 {{ iface.ip|ip_last_digit }}    IN      PTR     {{ iface.label }}.gina.sara.nl.
    312 
    313   {% endif %}
    314 {% endfor %}
    315 
    316 {% endnoblanklines %}
    317 {% endstore %}
Note: See TracChangeset for help on using the changeset viewer.