Dzahn has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394727 )
Change subject: ganglia: add decom bash script if on trusty (WIP) ...................................................................... ganglia: add decom bash script if on trusty (WIP) Bug:T177225 Change-Id: I3f314e06eab3b81d8c2b0dfc9990753078791d15 --- A modules/ganglia/files/kill-ganglia.sh M modules/ganglia/manifests/monitor/decommission.pp 2 files changed, 70 insertions(+), 40 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/27/394727/1 diff --git a/modules/ganglia/files/kill-ganglia.sh b/modules/ganglia/files/kill-ganglia.sh new file mode 100644 index 0000000..36b15a5 --- /dev/null +++ b/modules/ganglia/files/kill-ganglia.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# purge Ganglia (T177225) +# +# WIP - untested +/usr/bin/apt-get -y -q remove --purge ganglia-monitor libganglia1 +sleep 5 +killall -s 9 -u ganglia +rm -rf /usr/lib/ganglia +rm -rf /etc/ganglia +rm -rf /var/lib/ganglia +rm /run/ganglia-monitor.pid diff --git a/modules/ganglia/manifests/monitor/decommission.pp b/modules/ganglia/manifests/monitor/decommission.pp index 5f49ebe..fa731bf 100644 --- a/modules/ganglia/manifests/monitor/decommission.pp +++ b/modules/ganglia/manifests/monitor/decommission.pp @@ -1,46 +1,65 @@ +# T177225 class ganglia::monitor::decommission { - package { 'ganglia-monitor': - ensure => purged, - } - package { 'libganglia1': - ensure => purged, - } + # on trusty hosts the package removal doesn't always work reliably, + # and we got tired of debugging puppet issue for a one-time task, + # so here we are just installing a bash script that will be executed via cumin + # and removed again as the final step + if os_version('ubuntu == trusty') { - # We normally would need only /usr/lib/ganglia/python_modules but let's be - # ultra cautious here and purge the parent directory - file { '/usr/lib/ganglia/': - ensure => absent, - recurse => true, - force => true, - require => Package['ganglia-monitor'], - } - # This is handled by the purging of ganglia-monitor, but let's be extra - # explicit so that this is not ever created by some human mistake - file { '/etc/ganglia/': - ensure => absent, - recurse => true, - force => true, - require => Package['ganglia-monitor'], - } - # in some cases /var/lib/ganglia becomes a remnant - # with files like pdns_gmetric.state in it - file { '/var/lib/ganglia/': - ensure => absent, - recurse => true, - force => true, - require => Package['ganglia-monitor'], - } + file { '/usr/local/bin/kill-ganglia': + ensure => present, + owner => 'root', + group => 'root', + mode => '0544', + source => 'puppet:///modules/ganglia/kill-ganglia.sh', + } - # in some cases the pid file was left even when service was stopped - file { '/run/ganglia-monitor.pid': - ensure => absent, - } - file { '/etc/systemd/system/ganglia-monitor.service': - ensure => absent, - } + } else { - file { '/etc/systemd/system/ganglia-monitor-aggregator@.service': - ensure => absent, - } + package { 'ganglia-monitor': + ensure => purged, + } + + package { 'libganglia1': + ensure => purged, + } + + # We normally would need only /usr/lib/ganglia/python_modules but let's be + # ultra cautious here and purge the parent directory + file { '/usr/lib/ganglia/': + ensure => absent, + recurse => true, + force => true, + require => Package['ganglia-monitor'], + } + # This is handled by the purging of ganglia-monitor, but let's be extra + # explicit so that this is not ever created by some human mistake + file { '/etc/ganglia/': + ensure => absent, + recurse => true, + force => true, + require => Package['ganglia-monitor'], + } + # in some cases /var/lib/ganglia becomes a remnant + # with files like pdns_gmetric.state in it + file { '/var/lib/ganglia/': + ensure => absent, + recurse => true, + force => true, + require => Package['ganglia-monitor'], + } + + # in some cases the pid file was left even when service was stopped + file { '/run/ganglia-monitor.pid': + ensure => absent, + } + file { '/etc/systemd/system/ganglia-monitor.service': + ensure => absent, + } + + file { '/etc/systemd/system/ganglia-monitor-aggregator@.service': + ensure => absent, + } + } } -- To view, visit https://gerrit.wikimedia.org/r/394727 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3f314e06eab3b81d8c2b0dfc9990753078791d15 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Dzahn <dz...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits