init.sls 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. - template: jinja
  34. - require:
  35. - pkg: bind9
  36. - watch_in:
  37. - cmd: rndc-reload
  38. # Create zones directory
  39. /etc/bind/zones/:
  40. file.directory:
  41. - makedirs: true
  42. - user: root
  43. - group: root
  44. - mode: 755
  45. - require:
  46. - pkg: bind9
  47. # Copy static zone files
  48. /etc/bind/zones/static:
  49. file.recurse:
  50. - source: salt://dns-server/zones/static/
  51. - file_mode: 644
  52. - dir_mode: 755
  53. - user: root
  54. - group: root
  55. - clean: True
  56. - require:
  57. - file: /etc/bind/zones/
  58. - watch_in:
  59. - cmd: rndc-reload
  60. # Copy generated zone files
  61. /etc/bind/zones/generated:
  62. file.recurse:
  63. - source: salt://dns-server/zones/generated/
  64. - file_mode: 644
  65. - dir_mode: 755
  66. - user: root
  67. - group: root
  68. - clean: True
  69. - require:
  70. - file: /etc/bind/zones/
  71. - watch_in:
  72. - cmd: rndc-reload