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