control: 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 # for DHCP to start. # LocateLineMatching "^run_dhcpd=.*" BeginGroupIfNoLineMatching '^run_dhcpd=1' ReplaceLineWith 'run_dhcpd=1' EndGroup DefineClasses "dhcpd_reload" } { /etc/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.conf.$(site)" BeginGroupIfFileIsNewer "/etc/local-COMMON/dhcpd.conf.$(site)" AutoCreate EmptyEntireFilePlease InsertFile "/etc/local-COMMON/dhcpd.conf.$(site)" Append "# Edited by cfengine $(date)" EndGroup 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/dhcp3/dhcpd_$(fqhost).conf" BeginGroupIfFileIsNewer "/etc/local-COMMON/dhcp3/dhcpd_$(fqhost).conf" AutoCreate EmptyEntireFilePlease InsertFile "/etc/local-COMMON/dhcp3/dhcpd_$(fqhost).conf" Append "# Edited by cfengine $(date)" EndGroup DefineClasses "dhcpd3_reload" EndGroup } processes: !dhcpd3:: "dhcpd-2.2.x" restart "/etc/init.d/dhcp restart" dhcpd3:: "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"