Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 1 | {%- from "isc_dhcp/map.jinja" import server with context %} |
Ales Komarek | 96e3c2f | 2014-09-21 17:53:15 +0200 | [diff] [blame] | 2 | {%- if server.enabled %} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 3 | |
Ales Komarek | 96e3c2f | 2014-09-21 17:53:15 +0200 | [diff] [blame] | 4 | {%- if server.omapi_port is defined %} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 5 | omapi-port {{ server.omapi_port }}; |
| 6 | {% endif -%} |
| 7 | |
jan kaufman | 90c6114 | 2016-02-15 15:43:32 +0100 | [diff] [blame^] | 8 | {- if server.omapi_key and server.omapi_port is defined %} |
| 9 | key omapi_key { |
| 10 | algorithm HMAC-MD5; |
| 11 | secret "{{ server.omapi_key }}"; |
| 12 | }; |
| 13 | omapi-key omapi_key; |
| 14 | {%- endif %} |
| 15 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 16 | {%- if server.ddns_updates is defined %} |
| 17 | |
| 18 | ddns-updates on; |
| 19 | ddns-update-style interim; |
| 20 | |
| 21 | update-static-leases on; |
| 22 | use-host-decl-names on; |
| 23 | |
| 24 | {# |
| 25 | # Key from bind |
| 26 | include "<%= @dnsupdatekey %>"; |
| 27 | <% @dnsdomain.each do |dom| -%> |
| 28 | zone <%= dom %>. { |
| 29 | primary <%= @nameservers.first %>; |
| 30 | key <%= @dnskeyname%>; |
| 31 | } |
| 32 | #} |
| 33 | |
| 34 | {%- else -%} |
| 35 | |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 36 | ddns-update-style {{ server.ddns_update_style|default('none') }}; |
| 37 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 38 | {%- endif %} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 39 | |
| 40 | {%- if server.update_static_leases is defined %} |
| 41 | update-static-leases {{ server.update_static_leases }}; |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 42 | {%- endif %} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 43 | |
| 44 | {%- if server.use_host_decl_names is defined %} |
| 45 | use-host-decl-names {{ server.use_host_decl_names }}; |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 46 | {%- endif %} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 47 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 48 | {%- for zone_name, zone in server.zone.iteritems() %} |
| 49 | |
| 50 | zone {{ zone_name }} { |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 51 | primary {{ zone.primary }}; |
| 52 | {%- if 'key' in zone %} |
| 53 | key {{ zone.key|default('rndc-key') }}; |
| 54 | {%- endif %} |
| 55 | } |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 56 | |
| 57 | {%- endfor %} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 58 | |
| 59 | default-lease-time {{ server.default_lease_time|default('600') }}; |
| 60 | max-lease-time {{ server.max_lease_time|default('7200') }}; |
| 61 | |
| 62 | {%- if server.authoritative|default(False) %} |
| 63 | authoritative; |
| 64 | {%- endif %} |
| 65 | |
| 66 | log-facility {{ server.logging.facility|default('local7') }}; |
| 67 | |
| 68 | {%- if server.next_server is defined -%} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 69 | next-server {{ server.next_server }}; |
Ales Komarek | 5858c81 | 2014-09-21 17:58:20 +0200 | [diff] [blame] | 70 | {%- endif %} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 71 | |
| 72 | {%- if server.filename is defined %} |
| 73 | filename "{{ server.filename }}"; |
Ales Komarek | 5858c81 | 2014-09-21 17:58:20 +0200 | [diff] [blame] | 74 | {%- endif %} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 75 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 76 | option domain-name "{{ server.domain_name }}"; |
| 77 | option domain-name-servers {{ server.name_servers|join( ', ') }}; |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 78 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 79 | allow booting; |
| 80 | allow bootp; |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 81 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 82 | option fqdn.no-client-update on; # set the "O" and "S" flag bits |
| 83 | option fqdn.rcode2 255; |
| 84 | option pxegrub code 150 = text ; |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 85 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 86 | {# |
Ales Komarek | 3162e35 | 2014-09-21 16:45:03 +0200 | [diff] [blame] | 87 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 88 | <% if has_variable?( 'pxeserver' ) && |
| 89 | has_variable?( 'pxefilename' ) && |
| 90 | @pxeserver && |
| 91 | @pxefilename -%> |
| 92 | # PXE Handoff. |
| 93 | next-server <%= @pxeserver %>; |
| 94 | filename "<%= @pxefilename %>"; |
| 95 | <% end -%> |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 96 | |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 97 | #} |
Ales Komarek | 63c2db5 | 2014-09-15 09:26:22 +0200 | [diff] [blame] | 98 | |
Ales Komarek | 474b7c3 | 2014-09-21 17:54:11 +0200 | [diff] [blame] | 99 | include "{{ server.config_dir }}/dhcpd.hosts"; |
Ales Komarek | 04bad39 | 2014-09-21 18:02:42 +0200 | [diff] [blame] | 100 | include "{{ server.config_dir }}/dhcpd.subnets"; |
Ales Komarek | 6d9bc2c | 2014-09-21 17:25:05 +0200 | [diff] [blame] | 101 | |
jan kaufman | 90c6114 | 2016-02-15 15:43:32 +0100 | [diff] [blame^] | 102 | {%- endif %} |