db.servers.tld-template.j2 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ; zonefile for servers.{{item.key}}.
  2. $TTL 3600
  3. @ IN SOA {{bind_zonemaster.server}}. {{bind_zonemaster.email}}. (
  4. {{ansible_date_time.epoch}} ; Serial
  5. 604800 ; Refresh
  6. 86400 ; Retry
  7. 2419200 ; Expire
  8. 86400 ) ; Negative Cache TTL
  9. {% set i = [1] %}
  10. {% for host in groups['gateways'] %}
  11. {% if 'is_external_nameserver' in hostvars[host] and hostvars[host].is_external_nameserver %}
  12. @ IN NS ns{{i[0]}}.{{item.key}}.
  13. {% if i.append(i.pop() + 1) %}{% endif %}
  14. {% endif %}
  15. {% endfor %}
  16. {% if bind.ffms_for_groups is defined and bind.ffms_for_groups.0 is defined %}
  17. {% for group in bind.ffms_for_groups %}
  18. {% for host in groups[group] %}
  19. {{host}} IN A {{hostvars[host].ansible_ssh_host}};
  20. {% endfor %}
  21. {% endfor %}
  22. {% endif %}
  23. {% for host in groups['gateways']+groups['hypervisors'] %}
  24. {{host}} IN A {{hostvars[host].ansible_ssh_host}};
  25. {% endfor %}
  26. {% for host in groups['gateways'] %}
  27. {% if hostvars[host].domaenenliste is defined %}
  28. {% for domaene in hostvars[host].domaenenliste|dictsort %}
  29. domaene{{domaene[0]}} IN A {{hostvars[host].ansible_ssh_host}};
  30. {% if domaene[1].server_id is defined and domaene[1].server_id == 2 %}
  31. domaene{{domaene[0]}}-A IN A {{hostvars[host].ansible_ssh_host}};
  32. {% elif domaene[1].server_id is defined and domaene[1].server_id == 3 %}
  33. domaene{{domaene[0]}}-B IN A {{hostvars[host].ansible_ssh_host}};
  34. {% elif domaene[1].server_id is defined and domaene[1].server_id == 4 %}
  35. domaene{{domaene[0]}}-C IN A {{hostvars[host].ansible_ssh_host}};
  36. {% elif domaene[1].server_id is defined and domaene[1].server_id == 5 %}
  37. domaene{{domaene[0]}}-D IN A {{hostvars[host].ansible_ssh_host}};
  38. {% endif %}
  39. {% endfor %}
  40. {% endif %}
  41. {% endfor %}