Merge branch 'foreman' into 'master'
Foreman
See merge request !1
diff --git a/README.md b/README.md
index 7d195aa..ab08075 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,13 @@
## Sample pillars
-ISC DHCP server
+ISC DHCP server with defined host and subnet (client must use the same key)
isc_dhcp:
server:
enabled: true
omapi_port: 7911
+ omapi_key: iFdQ0kvpUo+3gzXGJTpjk7/dl9DI5SuDqMzasDUhBRGEg6VfNYUX+MAU14WoJJZDQbrvC4Pgsdfdsfdsfdsdf==
authoritative: true
interfaces:
- name: eth0
@@ -22,7 +23,15 @@
mac: 00:11:22:33:44:55:66
address: 192.168.0.1
hostname: domain.com
+ subnet:
+ testsubnet:
+ range: 10.0.0.1 10.0.0.100
+ netmask: 255.255.255.0
+ network: 10.0.0.0
+ pxeserver: 10.1.1.1
+
+
## Read more
-* http://chschneider.eu/linux/server/tftpd-hpa.shtml
\ No newline at end of file
+* http://chschneider.eu/linux/server/tftpd-hpa.shtml
diff --git a/isc_dhcp/files/dhcpd.conf b/isc_dhcp/files/dhcpd.conf
index ec97e4c..d0f93d2 100644
--- a/isc_dhcp/files/dhcpd.conf
+++ b/isc_dhcp/files/dhcpd.conf
@@ -3,7 +3,15 @@
{%- if server.omapi_port is defined %}
omapi-port {{ server.omapi_port }};
-{% endif -%}
+
+{%- if server.omapi_key is defined %}
+key omapi_key {
+ algorithm HMAC-MD5;
+ secret "{{ server.omapi_key }}";
+};
+omapi-key omapi_key;
+{% endif %}
+{%- endif %}
{%- if server.ddns_updates is defined %}
@@ -75,20 +83,11 @@
option fqdn.rcode2 255;
option pxegrub code 150 = text ;
-{#
-
-<% if has_variable?( 'pxeserver' ) &&
- has_variable?( 'pxefilename' ) &&
- @pxeserver &&
- @pxefilename -%>
-# PXE Handoff.
-next-server <%= @pxeserver %>;
-filename "<%= @pxefilename %>";
-<% end -%>
-
-#}
+{%- if server.pxeserver is defined %}
+next-server {{ server.pxeserver }};
+{%- endif %}
include "{{ server.config_dir }}/dhcpd.hosts";
include "{{ server.config_dir }}/dhcpd.subnets";
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/isc_dhcp/files/dhcpd.hosts b/isc_dhcp/files/dhcpd.hosts
index 359e5b1..8a4292f 100644
--- a/isc_dhcp/files/dhcpd.hosts
+++ b/isc_dhcp/files/dhcpd.hosts
@@ -1,5 +1,6 @@
{%- from "isc_dhcp/map.jinja" import server with context %}
+{%- if server.host is defined %}
{%- for host_name, host in server.host.iteritems() %}
host {{ host_name }} {
@@ -11,3 +12,5 @@
}
{%- endfor %}
+{%- endif %}
+