blob: f983f2057d4135c520d7e7d6ff81ab0291982dcd [file] [log] [blame]
Ales Komarek63c2db52014-09-15 09:26:22 +02001{%- from "isc_dhcp/map.jinja" import server with context %}
Ales Komarek96e3c2f2014-09-21 17:53:15 +02002{%- if server.enabled %}
Ales Komarek63c2db52014-09-15 09:26:22 +02003
Ales Komarek96e3c2f2014-09-21 17:53:15 +02004{%- if server.omapi_port is defined %}
Ales Komarek63c2db52014-09-15 09:26:22 +02005omapi-port {{ server.omapi_port }};
6{% endif -%}
7
Ales Komarek6d9bc2c2014-09-21 17:25:05 +02008{%- if server.ddns_updates is defined %}
9
10ddns-updates on;
11ddns-update-style interim;
12
13update-static-leases on;
14use-host-decl-names on;
15
16{#
17# Key from bind
18include "<%= @dnsupdatekey %>";
19<% @dnsdomain.each do |dom| -%>
20zone <%= dom %>. {
21 primary <%= @nameservers.first %>;
22 key <%= @dnskeyname%>;
23}
24#}
25
26{%- else -%}
27
Ales Komarek63c2db52014-09-15 09:26:22 +020028ddns-update-style {{ server.ddns_update_style|default('none') }};
29
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020030{%- endif %}
Ales Komarek63c2db52014-09-15 09:26:22 +020031
32{%- if server.update_static_leases is defined %}
33update-static-leases {{ server.update_static_leases }};
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020034{%- endif %}
Ales Komarek63c2db52014-09-15 09:26:22 +020035
36{%- if server.use_host_decl_names is defined %}
37use-host-decl-names {{ server.use_host_decl_names }};
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020038{%- endif %}
Ales Komarek63c2db52014-09-15 09:26:22 +020039
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020040{%- for zone_name, zone in server.zone.iteritems() %}
41
42zone {{ zone_name }} {
Ales Komarek63c2db52014-09-15 09:26:22 +020043 primary {{ zone.primary }};
44 {%- if 'key' in zone %}
45 key {{ zone.key|default('rndc-key') }};
46 {%- endif %}
47}
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020048
49{%- endfor %}
Ales Komarek63c2db52014-09-15 09:26:22 +020050
51default-lease-time {{ server.default_lease_time|default('600') }};
52max-lease-time {{ server.max_lease_time|default('7200') }};
53
54{%- if server.authoritative|default(False) %}
55authoritative;
56{%- endif %}
57
58log-facility {{ server.logging.facility|default('local7') }};
59
60{%- if server.next_server is defined -%}
61{{ "\n" }}
62next-server {{ server.next_server }};
63{%- endif -%}
64
65{%- if server.filename is defined %}
66filename "{{ server.filename }}";
67{{- "\n" }}
68{%- endif -%}
69
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020070option domain-name "{{ server.domain_name }}";
71option domain-name-servers {{ server.name_servers|join( ', ') }};
Ales Komarek63c2db52014-09-15 09:26:22 +020072
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020073allow booting;
74allow bootp;
Ales Komarek63c2db52014-09-15 09:26:22 +020075
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020076option fqdn.no-client-update on; # set the "O" and "S" flag bits
77option fqdn.rcode2 255;
78option pxegrub code 150 = text ;
Ales Komarek63c2db52014-09-15 09:26:22 +020079
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020080{#
Ales Komarek3162e352014-09-21 16:45:03 +020081
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020082<% if has_variable?( 'pxeserver' ) &&
83 has_variable?( 'pxefilename' ) &&
84 @pxeserver &&
85 @pxefilename -%>
86# PXE Handoff.
87next-server <%= @pxeserver %>;
88filename "<%= @pxefilename %>";
89<% end -%>
Ales Komarek63c2db52014-09-15 09:26:22 +020090
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020091#}
Ales Komarek63c2db52014-09-15 09:26:22 +020092
Ales Komarek474b7c32014-09-21 17:54:11 +020093include "{{ server.config_dir }}/dhcpd.hosts";
Ales Komarek6d9bc2c2014-09-21 17:25:05 +020094
Ales Komarek96e3c2f2014-09-21 17:53:15 +020095{%- endif %}