diff options
Diffstat (limited to 'cfengine/cf.services.dhcp')
-rw-r--r-- | cfengine/cf.services.dhcp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/cfengine/cf.services.dhcp b/cfengine/cf.services.dhcp index 695ebf0..81b7f4d 100644 --- a/cfengine/cf.services.dhcp +++ b/cfengine/cf.services.dhcp @@ -1,7 +1,14 @@ control: - AddInstallable = ( dhcpd_reload ) + AddInstallable = ( dhcpd_reload dhcpd3 dhcpd3_reload ) + +classes: + # + # Determine if this is a version 3 DHCP server + # + dhcpd3 = ( `/usr/bin/test -x /usr/sbin/dhcpd3` ) editfiles: + !dhcpd3:: { /etc/init.d/dhcp # # First of all, this is a DHCP server so let's make it possible @@ -28,10 +35,31 @@ editfiles: DefineClasses "dhcpd_reload" EndGroup } + dhcpd3:: + { /etc/dhcp3/dhcpd.conf + # + # We don't make the dhcp.conf dynamically, but instead we copy the contents + # of a master file, but only if it's newer than the one installed. + # + BeginGroupIfFileExists "/etc/local-COMMON/dhcpd_$(fqdn).conf" + BeginGroupIfFileIsNewer "/etc/local-COMMON/dhcpd_$(fqdn).conf" + AutoCreate + EmptyEntireFilePlease + InsertFile "/etc/local-COMMON/dhcpd_$(fqdn).conf" + Append "# Edited by cfengine $(date)" + EndGroup + DefineClasses "dhcpd3_reload" + EndGroup + } processes: + !dhcpd3:: "dhcpd-2.2.x" restart "/etc/init.d/dhcp restart" + dhcpd3:: + "" restart /etc/init.d/dhcp3-server restart" shellcommands: dhcpd_reload:: "/etc/init.d/dhcp force-reload" + dhcpd3_reload:: + "/etc/init.d/dhcp3-server force-reload" |