Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 1 | {%- from "isc_dhcp/map.jinja" import server with context %} |
| 2 | {%- if server.enabled %} |
| 3 | |
| 4 | isc_dhcp_packages: |
| 5 | pkg.installed: |
| 6 | - pkgs: {{ server.pkgs }} |
| 7 | |
Ales Komarek | 6c7958c | 2014-09-21 16:39:17 +0200 | [diff] [blame] | 8 | {{ server.defaults_config }}: |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 9 | file.managed: |
| 10 | - makedirs: True |
Ales Komarek | 6c7958c | 2014-09-21 16:39:17 +0200 | [diff] [blame] | 11 | - source: 'salt://isc_dhcp/files/defaults.{{ grains.os_family }}' |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 12 | - template: jinja |
| 13 | - mode: 644 |
| 14 | - require: |
Ales Komarek | 104df0f | 2014-09-21 17:49:46 +0200 | [diff] [blame] | 15 | - pkg: isc_dhcp_packages |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 16 | - watch_in: |
| 17 | - service: isc_dhcp_service |
| 18 | |
| 19 | {%- if server.dhcpd_config is defined %} |
| 20 | |
Ales Komarek | 6c7958c | 2014-09-21 16:39:17 +0200 | [diff] [blame] | 21 | {{ server.dhcpd_config }}: |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 22 | 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 | |
| 61 | isc_dhcp_service: |
| 62 | service.running: |
| 63 | - name: {{ server.service }} |
| 64 | - enable: true |
| 65 | |
jan kaufman | 99d61b0 | 2016-02-17 14:19:35 +0100 | [diff] [blame] | 66 | {%- endif %} |