init.sls 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #
  2. # FFHO DNS Server configuration (authoritive / recursive)
  3. #
  4. {% set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
  5. bind9:
  6. pkg.installed:
  7. - name: bind9
  8. service.running:
  9. - enable: True
  10. - reload: True
  11. # Reload command
  12. rndc-reload:
  13. cmd.wait:
  14. - watch: []
  15. - name: /usr/sbin/rndc reload
  16. # Bind options
  17. /etc/bind/named.conf.options:
  18. file.managed:
  19. {% if 'dns-recursor' in roles %}
  20. - source: salt://dns-server/named.conf.options.recursor
  21. {% else %}
  22. - source: salt://dns-server/named.conf.options
  23. {% endif %}
  24. - template: jinja
  25. - require:
  26. - pkg: bind9
  27. - watch_in:
  28. - cmd: rndc-reload
  29. # Configure authoritive zones in local config
  30. /etc/bind/named.conf.local:
  31. file.managed:
  32. - source: salt://dns-server/named.conf.local
  33. - require:
  34. - pkg: bind9
  35. - watch_in:
  36. - cmd: rndc-reload
  37. # Create zones directory
  38. /etc/bind/zones/:
  39. file.directory:
  40. - makedirs: true
  41. - user: root
  42. - group: root
  43. - mode: 755
  44. - require:
  45. - pkg: bind9
  46. # Copy static zone files
  47. /etc/bind/zones/static:
  48. file.recurse:
  49. - source: salt://dns-server/zones/static/
  50. - file_mode: 644
  51. - dir_mode: 755
  52. - user: root
  53. - group: root
  54. - clean: True
  55. - require:
  56. - file: /etc/bind/zones/
  57. - watch_in:
  58. - cmd: rndc-reload
  59. # Copy generated zone files
  60. /etc/bind/zones/generated:
  61. file.recurse:
  62. - source: salt://dns-server/zones/generated/
  63. - file_mode: 644
  64. - dir_mode: 755
  65. - user: root
  66. - group: root
  67. - clean: True
  68. - require:
  69. - file: /etc/bind/zones/
  70. - watch_in:
  71. - cmd: rndc-reload