diff options
author | Jesse Luehrs <doy@tozt.net> | 2024-02-27 00:08:27 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2024-02-27 00:08:27 -0500 |
commit | 991d4222c095b20d896866c39b877ea1290cb017 (patch) | |
tree | 251479529d4036de5c4ebf449e1320105767dacb /modules/systemd | |
parent | 528974eb4b1b9316d2d6082771466c42b562c163 (diff) | |
download | puppet-tozt-991d4222c095b20d896866c39b877ea1290cb017.tar.gz puppet-tozt-991d4222c095b20d896866c39b877ea1290cb017.zip |
convert the custom cron::job class to systemd
Diffstat (limited to 'modules/systemd')
-rw-r--r-- | modules/systemd/manifests/override.pp | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/modules/systemd/manifests/override.pp b/modules/systemd/manifests/override.pp index c605382..2128374 100644 --- a/modules/systemd/manifests/override.pp +++ b/modules/systemd/manifests/override.pp @@ -1,16 +1,32 @@ -define systemd::override($source = undef, $content = undef) { +define systemd::override($source = undef, $content = undef, $ensure = undef) { include systemd - file { - "/etc/systemd/system/${name}.service.d": - ensure => directory; - "/etc/systemd/system/${name}.service.d/override.conf": - source => $source, - content => $content, - notify => [ - Exec['/usr/bin/systemctl daemon-reload'], - Service["${name}"] - ], - require => File["/etc/systemd/system/${name}.service.d"]; + case $ensure { + 'absent': { + file { + "/etc/systemd/system/${name}.service.d": + ensure => absent; + "/etc/systemd/system/${name}.service.d/override.conf": + ensure => absent, + notify => [ + Exec['/usr/bin/systemctl daemon-reload'], + Service["${name}"] + ]; + } + } + default: { + file { + "/etc/systemd/system/${name}.service.d": + ensure => directory; + "/etc/systemd/system/${name}.service.d/override.conf": + source => $source, + content => $content, + notify => [ + Exec['/usr/bin/systemctl daemon-reload'], + Service["${name}"] + ], + require => File["/etc/systemd/system/${name}.service.d"]; + } + } } } |