-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from lsst-it/IT-5189/dhcp-service-without-install
split cni::plugins::dhcp::service out of ::dhcp class
- Loading branch information
Showing
3 changed files
with
46 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,12 @@ | ||
# | ||
# @summary Install the cni-dhcp service | ||
# @summary Install and enable the cni-dhcp service | ||
# | ||
class cni::plugins::dhcp { | ||
include cni::plugins | ||
include cni::plugins::dhcp::service | ||
|
||
ensure_resources('cni::plugins::enable', { 'dhcp' => {} }) | ||
|
||
$epp_vars = { | ||
prog => "${cni::bin_path}/dhcp", | ||
} | ||
|
||
systemd::unit_file { 'cni-dhcp.socket': | ||
content => epp("${module_name}/dhcp/cni-dhcp.socket.epp"), | ||
} | ||
-> systemd::unit_file { 'cni-dhcp.service': | ||
content => epp("${module_name}/dhcp/cni-dhcp.service.epp", $epp_vars), | ||
} | ||
~> service { 'cni-dhcp': | ||
ensure => 'running', | ||
enable => true, | ||
subscribe => Cni::Plugins::Enable['dhcp'], | ||
} | ||
# restart the service if the installed binary changes | ||
Cni::Plugins::Enable['dhcp'] ~> Service['cni-dhcp'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# @summary Enables the the cni-dhcp service | ||
# | ||
# Installs the cni-dhcp systemd service and enables it to start on boot. | ||
# | ||
# Explicit inclusion of this class is not necessary when using the | ||
# cni::plugins::dhcp class. | ||
# | ||
# This class is intended to be included directly only when it is desirable to enable | ||
# the cni-dhcp service without managing the installation of the cni plugin | ||
# binaries. | ||
# | ||
class cni::plugins::dhcp::service { | ||
$epp_vars = { | ||
prog => "${cni::bin_path}/dhcp", | ||
} | ||
|
||
systemd::unit_file { 'cni-dhcp.socket': | ||
content => epp("${module_name}/dhcp/cni-dhcp.socket.epp"), | ||
} | ||
-> systemd::unit_file { 'cni-dhcp.service': | ||
content => epp("${module_name}/dhcp/cni-dhcp.service.epp", $epp_vars), | ||
} | ||
~> service { 'cni-dhcp': | ||
ensure => 'running', | ||
enable => true, | ||
} | ||
} |