summaryrefslogtreecommitdiff
path: root/cfengine/cf.services.dhcp
blob: 27dcdd3a562670d6cfc206474a8da6699349d988 (plain)
  1. control:
  2.     AddInstallable = ( dhcpd_reload dhcpd3 dhcpd3_reload )
  3. classes:
  4. #
  5. # Determine if this is a version 3 DHCP server
  6. #
  7. dhcpd3 = ( `/usr/bin/test -x /usr/sbin/dhcpd3` )
  8. editfiles:
  9. !dhcpd3::
  10. { /etc/init.d/dhcp
  11. #
  12. # First of all, this is a DHCP server so let's make it possible
  13. # for DHCP to start.
  14. #
  15. LocateLineMatching "^run_dhcpd=.*"
  16. BeginGroupIfNoLineMatching '^run_dhcpd=1'
  17. ReplaceLineWith 'run_dhcpd=1'
  18. EndGroup
  19. DefineClasses "dhcpd_reload"
  20. }
  21. { /etc/dhcpd.conf
  22. #
  23. # We don't make the dhcp.conf dynamically, but instead we copy the contents
  24. # of a master file, but only if it's newer than the one installed.
  25. #
  26. BeginGroupIfFileExists "/etc/local-COMMON/dhcpd.conf.$(site)"
  27. BeginGroupIfFileIsNewer "/etc/local-COMMON/dhcpd.conf.$(site)"
  28. AutoCreate
  29. EmptyEntireFilePlease
  30. InsertFile "/etc/local-COMMON/dhcpd.conf.$(site)"
  31. Append "# Edited by cfengine $(date)"
  32. EndGroup
  33. DefineClasses "dhcpd_reload"
  34. EndGroup
  35. }
  36. dhcpd3::
  37. { /etc/dhcp3/dhcpd.conf
  38. #
  39. # We don't make the dhcp.conf dynamically, but instead we copy the contents
  40. # of a master file, but only if it's newer than the one installed.
  41. #
  42. BeginGroupIfFileExists "/etc/local-COMMON/dhcp3/dhcpd_$(fqhost).conf"
  43. BeginGroupIfFileIsNewer "/etc/local-COMMON/dhcp3/dhcpd_$(fqhost).conf"
  44. AutoCreate
  45. EmptyEntireFilePlease
  46. InsertFile "/etc/local-COMMON/dhcp3/dhcpd_$(fqhost).conf"
  47. Append "# Edited by cfengine $(date)"
  48. EndGroup
  49. DefineClasses "dhcpd3_reload"
  50. EndGroup
  51. }
  52. processes:
  53. !dhcpd3::
  54. "dhcpd-2.2.x" restart "/etc/init.d/dhcp restart"
  55. dhcpd3::
  56. "dhcpd3" restart "/etc/init.d/dhcp3-server restart"
  57. shellcommands:
  58. dhcpd_reload::
  59. "/etc/init.d/dhcp force-reload"
  60. dhcpd3_reload::
  61. "/etc/init.d/dhcp3-server force-reload"