blob: 2037f01fad4549f711cf4f84c9f14f3b1a759d7b [file] [log] [blame]
Ales Komarek63c2db52014-09-15 09:26:22 +02001{%- from "isc_dhcp/map.jinja" import server with context %}
2{%- if server.enabled %}
3
4isc_dhcp_packages:
5 pkg.installed:
6 - pkgs: {{ server.pkgs }}
7
Ales Komarek6c7958c2014-09-21 16:39:17 +02008{{ server.defaults_config }}:
Ales Komarek63c2db52014-09-15 09:26:22 +02009 file.managed:
10 - makedirs: True
Ales Komarek6c7958c2014-09-21 16:39:17 +020011 - source: 'salt://isc_dhcp/files/defaults.{{ grains.os_family }}'
Ales Komarek63c2db52014-09-15 09:26:22 +020012 - template: jinja
13 - mode: 644
14 - require:
Ales Komarek104df0f2014-09-21 17:49:46 +020015 - pkg: isc_dhcp_packages
Ales Komarek63c2db52014-09-15 09:26:22 +020016 - watch_in:
17 - service: isc_dhcp_service
18
19{%- if server.dhcpd_config is defined %}
20
Ales Komarek6c7958c2014-09-21 16:39:17 +020021{{ server.dhcpd_config }}:
Ales Komarek63c2db52014-09-15 09:26:22 +020022 file.managed:
23 - source: salt://isc_dhcp/files/dhcpd.conf
24 - template: jinja
25 - mode: 644
26 - require:
27 - pkg: isc_dhcp_packages
28 - watch_in:
29 - service: isc_dhcp_service
30
31{%- endif %}
32
33{%- if server.hosts_config is defined %}
34
35{{ server.hosts_config }}:
36 file.managed:
37 - source: salt://isc_dhcp/files/dhcpd.hosts
38 - template: jinja
39 - mode: 644
40 - require:
41 - pkg: isc_dhcp_packages
42 - watch_in:
43 - service: isc_dhcp_service
44
45{%- endif %}
46
47{%- if server.subnets_config is defined %}
48
49{{ server.subnets_config }}:
50 file.managed:
51 - source: salt://isc_dhcp/files/dhcpd.subnets
52 - template: jinja
53 - mode: 644
54 - require:
55 - pkg: isc_dhcp_packages
56 - watch_in:
57 - service: isc_dhcp_service
58
59{%- endif %}
60
61isc_dhcp_service:
62 service.running:
63 - name: {{ server.service }}
64 - enable: true
65
jan kaufman99d61b02016-02-17 14:19:35 +010066{%- endif %}