blob: cd7d3d706b3e96b92ec90179e0b4971246bf9d7c [file] [log] [blame]
Ales Komarek882ac7b2014-07-14 10:47:56 +02001{% from "bind/map.jinja" import server with context %}
2
3bind_packages:
4 pkg.installed:
5 - pkgs: {{ server.pkgs|json }}
6
7named_directory:
8 file.directory:
9 - name: {{ map.named_directory }}
10 - user: {{ salt['pillar.get']('bind:config:user', map.user) }}
11 - group: {{ salt['pillar.get']('bind:config:group', map.group) }}
12 - mode: 775
13 - makedirs: True
14 - require:
15 - pkg: bind
16
17{% if grains.os_family == 'RedHat' %}
18bind_config:
19 file.managed:
20 - name: {{ map.config }}
21 - source: 'salt://bind/files/redhat/named.conf'
22 - template: jinja
23 - user: {{ salt['pillar.get']('bind:config:user', map.user) }}
24 - group: {{ salt['pillar.get']('bind:config:group', map.group) }}
25 - mode: {{ salt['pillar.get']('bind:config:mode', '640') }}
26 - require:
27 - pkg: bind
28 - watch_in:
29 - service: bind
30
31bind_local_config:
32 file.managed:
33 - name: {{ map.local_config }}
34 - source: 'salt://bind/files/redhat/named.conf.local'
35 - template: jinja
36 - user: {{ salt['pillar.get']('bind:config:user', map.user) }}
37 - group: {{ salt['pillar.get']('bind:config:group', map.group) }}
38 - mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
39 - require:
40 - pkg: bind
41 - watch_in:
42 - service: named
43{% endif %}
44
45{% if grains['os_family'] == 'Debian' %}
46bind_config:
47 file:
48 - managed
49 - name: {{ map.config }}
50 - source: 'salt://bind/files/debian/named.conf'
51 - template: jinja
52 - user: {{ salt['pillar.get']('bind:config:user', map.user) }}
53 - group: {{ salt['pillar.get']('bind:config:group', map.group) }}
54 - mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
55 - require:
56 - pkg: bind
57 - watch_in:
58 - service: bind
59
60bind_local_config:
61 file:
62 - managed
63 - name: {{ map.local_config }}
64 - source: 'salt://bind/files/debian/named.conf.local'
65 - template: jinja
66 - user: {{ salt['pillar.get']('bind:config:user', map.user) }}
67 - group: {{ salt['pillar.get']('bind:config:group', map.group) }}
68 - mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
69 - require:
70 - pkg: bind
71 - watch_in:
72 - service: bind
73
74bind_options_config:
75 file:
76 - managed
77 - name: {{ map.options_config }}
78 - source: 'salt://bind/files/debian/named.conf.options'
79 - template: jinja
80 - user: {{ salt['pillar.get']('bind:config:user', map.user) }}
81 - group: {{ salt['pillar.get']('bind:config:group', map.group) }}
82 - mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
83 - require:
84 - pkg: bind
85 - watch_in:
86 - service: bind
87
88bind_default_zones:
89 file:
90 - managed
91 - name: {{ map.default_zones_config }}
92 - source: 'salt://bind/files/debian/named.conf.default-zones'
93 - template: jinja
94 - user: {{ salt['pillar.get']('bind:config:user', map.user) }}
95 - group: {{ salt['pillar.get']('bind:config:group', map.group) }}
96 - mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
97 - require:
98 - pkg: bind
99 - watch_in:
100 - service: bind
101
102/var/log/bind9:
103 file:
104 - directory
105 - user: root
106 - group: bind
107 - mode: 775
108 - template: jinja
109
110
111/etc/logrotate.d/bind9:
112 file:
113 - managed
114 - source: salt://bind/files/debian/logrotate_bind
115 - user: root
116 - group: root
117
118{%- endif %}
119
120bind_service:
121 service.running:
122 - name: {{ server.service }}
123 - enable: true
124 - reload: true
125 - require:
126 - pkg: bind_packages