From: Julien Cristau Date: Tue, 20 Nov 2018 20:28:40 +0000 (+0100) Subject: Rename our systemd module to dsa_systemd X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=0ba93256399fbad7ed8fabfa39c24dd47169dde3;p=mirror%2Fdsa-puppet.git Rename our systemd module to dsa_systemd Avoid conflict with 3rdparty. --- diff --git a/modules/bacula/manifests/client.pp b/modules/bacula/manifests/client.pp index 8c33181b2..ea15b7325 100644 --- a/modules/bacula/manifests/client.pp +++ b/modules/bacula/manifests/client.pp @@ -63,7 +63,7 @@ class bacula::client inherits bacula { file { '/etc/systemd/system/bacula-fd.service.d/user.conf': ensure => absent, } - systemd::override { 'bacula-fd': + dsa_systemd::override { 'bacula-fd': content => @(EOT) [Service] ExecStart= @@ -74,7 +74,7 @@ class bacula::client inherits bacula { file { '/etc/systemd/system/bacula-fd.service.d/user.conf': ensure => absent, } - systemd::override { 'bacula-fd': + dsa_systemd::override { 'bacula-fd': ensure => absent, } } diff --git a/modules/bacula/manifests/director.pp b/modules/bacula/manifests/director.pp index 86c903d6d..d0e0fa599 100644 --- a/modules/bacula/manifests/director.pp +++ b/modules/bacula/manifests/director.pp @@ -10,7 +10,7 @@ class bacula::director inherits bacula { hasstatus => true, require => Package['bacula-director-pgsql'] } - systemd::override { 'bacula-director': + dsa_systemd::override { 'bacula-director': content => @(EOT) [Unit] After=unbound.service diff --git a/modules/bacula/manifests/storage.pp b/modules/bacula/manifests/storage.pp index 1e538bf17..9f72e0e0d 100644 --- a/modules/bacula/manifests/storage.pp +++ b/modules/bacula/manifests/storage.pp @@ -9,7 +9,7 @@ class bacula::storage inherits bacula { enable => true, hasstatus => true, } - systemd::override { 'bacula-sd': + dsa_systemd::override { 'bacula-sd': content => @(EOT) [Service] Group=bacula diff --git a/modules/buildd/manifests/init.pp b/modules/buildd/manifests/init.pp index 9bbbeea2b..a54f54863 100644 --- a/modules/buildd/manifests/init.pp +++ b/modules/buildd/manifests/init.pp @@ -138,7 +138,7 @@ class buildd ($ensure=present) { mode => '755', } file { '/etc/systemd/journald.conf.d/persistency.conf': - source => 'puppet:///modules/systemd/persistency.conf', + source => 'puppet:///modules/dsa_systemd/persistency.conf', } # Make sure that the build directory have the correct permissions. diff --git a/modules/debian_org/manifests/init.pp b/modules/debian_org/manifests/init.pp index 6e1c5dadc..6bb70c52d 100644 --- a/modules/debian_org/manifests/init.pp +++ b/modules/debian_org/manifests/init.pp @@ -6,7 +6,7 @@ class debian_org { include debian_org::apt if $systemd { - include systemd + include dsa_systemd $servicefiles = 'present' } else { $servicefiles = 'absent' diff --git a/modules/dsa_systemd/files/journald.conf b/modules/dsa_systemd/files/journald.conf new file mode 100644 index 000000000..7e6b60992 --- /dev/null +++ b/modules/dsa_systemd/files/journald.conf @@ -0,0 +1,7 @@ +## +## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. +## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git +## + +[Journal] +ForwardToSyslog=no diff --git a/modules/dsa_systemd/files/persistency.conf b/modules/dsa_systemd/files/persistency.conf new file mode 100644 index 000000000..efd0286ef --- /dev/null +++ b/modules/dsa_systemd/files/persistency.conf @@ -0,0 +1,7 @@ +## +## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. +## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git +## + +[Journal] +Storage=persistent diff --git a/modules/dsa_systemd/files/systemd-cleanup-failed b/modules/dsa_systemd/files/systemd-cleanup-failed new file mode 100755 index 000000000..3c0a3b68f --- /dev/null +++ b/modules/dsa_systemd/files/systemd-cleanup-failed @@ -0,0 +1,16 @@ +#!/bin/bash + +# if a client goes away on socket activated connections before systemd launches +# the process, things go sad and result in failed services. +# +# cf. https://github.com/systemd/systemd/issues/7172 +# +# should be fixed in buster and newer, but for now clean those up. + +systemctl --failed --no-legend | awk '{print $1}' | \ + while read service; do + if [[ $service =~ ^rsyncd-[a-z0-9-]*@.*\.service$ ]] || + [[ $service =~ ^session-[0-9]+\.scope$ ]]; then + systemctl reset-failed "$service" + fi +done diff --git a/modules/dsa_systemd/manifests/init.pp b/modules/dsa_systemd/manifests/init.pp new file mode 100644 index 000000000..5fff2c1a3 --- /dev/null +++ b/modules/dsa_systemd/manifests/init.pp @@ -0,0 +1,30 @@ +class dsa_systemd { + file { '/etc/systemd/journald.conf': + source => 'puppet:///modules/dsa_systemd/journald.conf', + } + + dsa_systemd::mask { 'sys-kernel-debug-tracing.mount': } + dsa_systemd::mask { 'sys-kernel-debug.mount': } + + include stretch::network_online + + if $::hostname == 'godard' { + exec {'mkdir -p /etc/systemd/journald.conf.d': + unless => 'test -d /etc/systemd/journald.conf.d', + } + file { '/etc/systemd/journald.conf.d/persistency.conf': + source => 'puppet:///modules/dsa_systemd/persistency.conf', + } + } + + file { '/usr/local/sbin/systemd-cleanup-failed': + source => 'puppet:///modules/dsa_systemd/systemd-cleanup-failed', + mode => '0555', + } + concat::fragment { 'dsa-puppet-stuff--systemd-cleanup-failed': + target => '/etc/cron.d/dsa-puppet-stuff', + content => @("EOF"), + */10 * * * * root /usr/local/sbin/systemd-cleanup-failed + | EOF + } +} diff --git a/modules/dsa_systemd/manifests/mask.pp b/modules/dsa_systemd/manifests/mask.pp new file mode 100644 index 000000000..cb67ab840 --- /dev/null +++ b/modules/dsa_systemd/manifests/mask.pp @@ -0,0 +1,21 @@ +define dsa_systemd::mask ( + $ensure = present, + ) { + $filename = "/etc/systemd/system/${name}" + + case $ensure { + present: { + $linkensure = "link" + } + absent: { + $linkensure = "absent" + } + default: { fail ( "Unknown ensure value: '$ensure'" ) } + } + + file { $filename: + ensure => $linkensure, + target => '/dev/null', + notify => Exec['systemctl daemon-reload'], + } +} diff --git a/modules/dsa_systemd/manifests/override.pp b/modules/dsa_systemd/manifests/override.pp new file mode 100644 index 000000000..b2d210f11 --- /dev/null +++ b/modules/dsa_systemd/manifests/override.pp @@ -0,0 +1,54 @@ +define dsa_systemd::override ( + $source=undef, + $content=undef, + $ensure=present +) { + + $dir = "/etc/systemd/system/${name}.service.d" + $dest = "${dir}/override.conf" + case $ensure { + present: { + if ! ($source or $content) { + fail ( "No configuration found for ${name}" ) + } + + file { "${dir}": + ensure => directory, + mode => '0755' + } + if $content { + file { "${dest}": + ensure => $ensure, + content => $content, + notify => [ Exec['systemctl daemon-reload'], + Service["${name}"], + ] + } + } elsif $source { + file { "${dest}": + ensure => $ensure, + source => $source, + notify => [ Exec['systemctl daemon-reload'], + Service["${name}"], + ] + } + } + } + absent: { + if defined(Service["${name}"]) { + $notify = [ Exec['systemctl daemon-reload'], Service["${name}"] ] + } else { + $notify = [ Exec['systemctl daemon-reload'] ] + } + + file { "${dest}": + ensure => $ensure, + notify => $notify, + } + file { "${dir}": + ensure => $ensure + } + } + default: { fail ( "Unknown ensure value: '$ensure'" ) } + } +} diff --git a/modules/haveged/manifests/init.pp b/modules/haveged/manifests/init.pp index a9c9ae27b..a172a782c 100644 --- a/modules/haveged/manifests/init.pp +++ b/modules/haveged/manifests/init.pp @@ -12,7 +12,7 @@ class haveged { } # work around #858134 - systemd::override { 'haveged': + dsa_systemd::override { 'haveged': ensure => $ensure, content => @(EOT) [Unit] diff --git a/modules/munin/manifests/init.pp b/modules/munin/manifests/init.pp index 5ea2762b0..8e4e7f285 100644 --- a/modules/munin/manifests/init.pp +++ b/modules/munin/manifests/init.pp @@ -89,7 +89,7 @@ class munin { ensure => running, require => Package['munin-async'], } - systemd::override { 'munin-async': + dsa_systemd::override { 'munin-async': content => @("EOF"), [Service] RestartSec=10 diff --git a/modules/onion/manifests/balance.pp b/modules/onion/manifests/balance.pp index bbf140ad7..d3f5ba8f0 100644 --- a/modules/onion/manifests/balance.pp +++ b/modules/onion/manifests/balance.pp @@ -8,7 +8,7 @@ class onion::balance { ensure => running, require => Package['onionbalance'], } - systemd::override { 'onionbalance': + dsa_systemd::override { 'onionbalance': ensure => $ensure, content => @(EOT) [Unit] diff --git a/modules/roles/manifests/rtc.pp b/modules/roles/manifests/rtc.pp index 3e9799d50..2a6adcd03 100644 --- a/modules/roles/manifests/rtc.pp +++ b/modules/roles/manifests/rtc.pp @@ -97,7 +97,7 @@ class roles::rtc { service { 'repro': ensure => running, } - systemd::override { 'repro': + dsa_systemd::override { 'repro': content => @("EOF"), [Unit] After=network-online.target diff --git a/modules/systemd/files/journald.conf b/modules/systemd/files/journald.conf deleted file mode 100644 index 7e6b60992..000000000 --- a/modules/systemd/files/journald.conf +++ /dev/null @@ -1,7 +0,0 @@ -## -## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. -## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git -## - -[Journal] -ForwardToSyslog=no diff --git a/modules/systemd/files/persistency.conf b/modules/systemd/files/persistency.conf deleted file mode 100644 index efd0286ef..000000000 --- a/modules/systemd/files/persistency.conf +++ /dev/null @@ -1,7 +0,0 @@ -## -## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. -## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git -## - -[Journal] -Storage=persistent diff --git a/modules/systemd/files/systemd-cleanup-failed b/modules/systemd/files/systemd-cleanup-failed deleted file mode 100755 index 3c0a3b68f..000000000 --- a/modules/systemd/files/systemd-cleanup-failed +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# if a client goes away on socket activated connections before systemd launches -# the process, things go sad and result in failed services. -# -# cf. https://github.com/systemd/systemd/issues/7172 -# -# should be fixed in buster and newer, but for now clean those up. - -systemctl --failed --no-legend | awk '{print $1}' | \ - while read service; do - if [[ $service =~ ^rsyncd-[a-z0-9-]*@.*\.service$ ]] || - [[ $service =~ ^session-[0-9]+\.scope$ ]]; then - systemctl reset-failed "$service" - fi -done diff --git a/modules/systemd/manifests/init.pp b/modules/systemd/manifests/init.pp deleted file mode 100644 index 2ee492f6e..000000000 --- a/modules/systemd/manifests/init.pp +++ /dev/null @@ -1,30 +0,0 @@ -class systemd { - file { '/etc/systemd/journald.conf': - source => 'puppet:///modules/systemd/journald.conf', - } - - systemd::mask { 'sys-kernel-debug-tracing.mount': } - systemd::mask { 'sys-kernel-debug.mount': } - - include stretch::network_online - - if $::hostname == 'godard' { - exec {'mkdir -p /etc/systemd/journald.conf.d': - unless => 'test -d /etc/systemd/journald.conf.d', - } - file { '/etc/systemd/journald.conf.d/persistency.conf': - source => 'puppet:///modules/systemd/persistency.conf', - } - } - - file { '/usr/local/sbin/systemd-cleanup-failed': - source => 'puppet:///modules/systemd/systemd-cleanup-failed', - mode => '0555', - } - concat::fragment { 'dsa-puppet-stuff--systemd-cleanup-failed': - target => '/etc/cron.d/dsa-puppet-stuff', - content => @("EOF"), - */10 * * * * root /usr/local/sbin/systemd-cleanup-failed - | EOF - } -} diff --git a/modules/systemd/manifests/mask.pp b/modules/systemd/manifests/mask.pp deleted file mode 100644 index 75a1a4334..000000000 --- a/modules/systemd/manifests/mask.pp +++ /dev/null @@ -1,21 +0,0 @@ -define systemd::mask ( - $ensure = present, - ) { - $filename = "/etc/systemd/system/${name}" - - case $ensure { - present: { - $linkensure = "link" - } - absent: { - $linkensure = "absent" - } - default: { fail ( "Unknown ensure value: '$ensure'" ) } - } - - file { $filename: - ensure => $linkensure, - target => '/dev/null', - notify => Exec['systemctl daemon-reload'], - } -} diff --git a/modules/systemd/manifests/override.pp b/modules/systemd/manifests/override.pp deleted file mode 100644 index 24403f602..000000000 --- a/modules/systemd/manifests/override.pp +++ /dev/null @@ -1,54 +0,0 @@ -define systemd::override ( - $source=undef, - $content=undef, - $ensure=present -) { - - $dir = "/etc/systemd/system/${name}.service.d" - $dest = "${dir}/override.conf" - case $ensure { - present: { - if ! ($source or $content) { - fail ( "No configuration found for ${name}" ) - } - - file { "${dir}": - ensure => directory, - mode => '0755' - } - if $content { - file { "${dest}": - ensure => $ensure, - content => $content, - notify => [ Exec['systemctl daemon-reload'], - Service["${name}"], - ] - } - } elsif $source { - file { "${dest}": - ensure => $ensure, - source => $source, - notify => [ Exec['systemctl daemon-reload'], - Service["${name}"], - ] - } - } - } - absent: { - if defined(Service["${name}"]) { - $notify = [ Exec['systemctl daemon-reload'], Service["${name}"] ] - } else { - $notify = [ Exec['systemctl daemon-reload'] ] - } - - file { "${dest}": - ensure => $ensure, - notify => $notify, - } - file { "${dir}": - ensure => $ensure - } - } - default: { fail ( "Unknown ensure value: '$ensure'" ) } - } -} diff --git a/modules/varnish/manifests/config.pp b/modules/varnish/manifests/config.pp index 0598e605e..dc407f998 100644 --- a/modules/varnish/manifests/config.pp +++ b/modules/varnish/manifests/config.pp @@ -20,7 +20,7 @@ define varnish::config ( $listenarr = [] + $listen $listenstr = join(prefix($listenarr, "-a "), " ") - systemd::override { 'varnish': + dsa_systemd::override { 'varnish': content => @("EOF"), [Unit] After=network-online.target