Skip to content

Commit

Permalink
Merge pull request #75 from jordiprats/master
Browse files Browse the repository at this point in the history
dropin dir enhancements
  • Loading branch information
jordiprats authored Jan 18, 2018
2 parents 6290caf + 0ec1365 commit 513a088
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.1.37

* Modified **systemd::service::dropin** to allow multiple drop in files per service as suggested in [Issue 49](https://github.com/NTTCom-MS/eyp-systemd/issues/49) by [cedef](https://github.com/cedef)

## 0.1.36

* added ability to **systemd::service** to use OnFailure - thanks to [TuningYourCode](https://github.com/TuningYourCode) for this [PR-65](https://github.com/NTTCom-MS/eyp-systemd/pull/65)
Expand Down
4 changes: 1 addition & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# puppet2sitepp @systemdservices
define systemd::service (
$servicename = $name,
$execstart = undef,
$execstop = undef,
$execreload = undef,
Expand All @@ -8,7 +9,6 @@
$restart = undef,
$user = 'root',
$group = 'root',
$servicename = $name,
$forking = false,
$pid_file = undef,
$description = undef,
Expand Down Expand Up @@ -97,7 +97,6 @@
include ::systemd
}


file { "/etc/systemd/system/${servicename}.service":
ensure => 'present',
owner => 'root',
Expand All @@ -106,5 +105,4 @@
content => template("${module_name}/service.erb"),
notify => Exec['systemctl daemon-reload'],
}

}
27 changes: 18 additions & 9 deletions manifests/service/dropin.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
define systemd::service::dropin (
$dropin_order = '99',
$dropin_name = 'override',
$servicename = $name,
$execstart = undef,
$execstop = undef,
$execreload = undef,
Expand All @@ -7,7 +10,6 @@
$restart = undef,
$user = undef,
$group = undef,
$servicename = $name,
$pid_file = undef,
$description = undef,
$after = undef,
Expand Down Expand Up @@ -47,6 +49,7 @@
$successexitstatus = [],
$killsignal = undef,
$syslogidentifier = undef,
$purge_dropin_dir = true,
) {

if ($env_vars != undef )
Expand Down Expand Up @@ -75,19 +78,25 @@
include ::systemd
}

file { "/etc/systemd/system/${servicename}.service.d/":
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0755',
}

file { "/etc/systemd/system/${servicename}.service.d/override.conf":
file { "/etc/systemd/system/${servicename}.service.d/${dropin_order}-${dropin_name}.conf":
ensure => 'present',
owner => 'root',
group => 'root',
mode => '0644',
content => template("${module_name}/service.erb"),
notify => Exec['systemctl daemon-reload'],
}

if(!defined(File["/etc/systemd/system/${servicename}.service.d/"]))
{
file { "/etc/systemd/system/${servicename}.service.d/":
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0755',
purge => $purge_dropin_dir,
recurse => $purge_dropin_dir,
notify => Exec['systemctl daemon-reload'],
}
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eyp-systemd",
"version": "0.1.36",
"version": "0.1.37",
"author": "eyp",
"summary": "management of systemd services (/etc/systemd/system/...), basic socket management",
"license": "Apache-2.0",
Expand Down

0 comments on commit 513a088

Please sign in to comment.