main.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ---
  2. # Deploys the infrastructure modifications needed to support SNOx node installation:
  3. #
  4. # - DNS zone files
  5. # - DNS zone configuration
  6. # - bastion zone delegation
  7. # - DHCP server modifications
  8. #
  9. # REQUIRES:
  10. # - variable "node" according to vms structure
  11. #
  12. - name: Publish forward DNS zone
  13. template:
  14. src: templates/sno.zone.j2
  15. dest: /var/named/{{ node.cluster }}.example.com.zone
  16. mode: 0640
  17. owner: root
  18. group: named
  19. notify:
  20. - reload_named
  21. - name: Configure DNS to load the published zone
  22. lineinfile:
  23. path: /etc/named.conf
  24. insertafter: "^# BEGIN ANSIBLE MANAGED DNS ZONES$"
  25. regexp: '^zone "{{ node.cluster }}.example.com"'
  26. line: 'zone "{{ node.cluster }}.example.com" { type master; file "{{ node.cluster }}.example.com.zone"; allow-update { none; }; };'
  27. state: present
  28. notify:
  29. - reload_named
  30. - name: Update reverse DNS zone
  31. lineinfile:
  32. path: /var/named/50.168.192.in-addr.arpa.zone
  33. insertafter: "^; BEGIN DYNAMIC 50 rZONE RECORDS$"
  34. regexp: "^{{ node.ip | regex_replace('^192.168.50.', '') }}"
  35. line: "{{ node.ip | regex_replace('^192.168.50.', '') }} IN PTR {{ node.name }}.{{ node.cluster }}.example.com."
  36. state: present
  37. register: zoneupdate
  38. #- name: Extract the serial if rzone was updated
  39. #- name: Bump up the serial if rzone was updated
  40. # TODO: delegate zone on bastion
  41. # TODO: make sure DHCP server recognizes us
  42. ...