From 814c343721dc6547d6abefe3fd6ae9861f3996bc Mon Sep 17 00:00:00 2001 From: Keith Whyte Date: Wed, 21 Oct 2020 18:31:18 +0200 Subject: [PATCH] Enable commenting of cronjobs if the system is not yet in production If a system is not fully deployed, then these cronjobs will generate errors and a lot of email. --- modules/rhizo_base/manifests/init.pp | 7 +++++++ modules/rhizo_base/templates/rhizomatica.cron.erb | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/rhizo_base/manifests/init.pp b/modules/rhizo_base/manifests/init.pp index ea1eec3..8c71d2c 100644 --- a/modules/rhizo_base/manifests/init.pp +++ b/modules/rhizo_base/manifests/init.pp @@ -15,6 +15,7 @@ class rhizo_base { $mail_admins = hiera('rhizo::mail_admins') $smsc_password = hiera('rhizo::smsc_password') $password_hash = hiera('rhizo::password_hash') + $production = hiera('rhizo::production', 1) # Configuration settings $notouchcron = hiera('rhizo::notouchcron', 0) @@ -669,6 +670,12 @@ schedule { 'never': content => template('rhizo_base/apcupsd.erb'), } + $comment = $production ? { + 0 => '#', + 1 => '', + default => '' + } + unless $notouchcron == 1 { file { '/etc/cron.d/rhizomatica': ensure => 'present', diff --git a/modules/rhizo_base/templates/rhizomatica.cron.erb b/modules/rhizo_base/templates/rhizomatica.cron.erb index 281babd..0297591 100644 --- a/modules/rhizo_base/templates/rhizomatica.cron.erb +++ b/modules/rhizo_base/templates/rhizomatica.cron.erb @@ -17,9 +17,9 @@ PYTHONPATH=$PYTHONPATH:/var/rhizomatica/rccn 0 3 * * * root /var/rhizomatica/bin/sms_cleanup.sh #RRDtools graphs -*/5 * * * * root /var/rhizomatica/bin/platform_update_rrd.sh -*/5 * * * * root /var/rhizomatica/bin/network_update_rrd.sh -*/1 * * * * root /var/rhizomatica/bin/network_update60.sh +<%= @comment -%>*/5 * * * * root /var/rhizomatica/bin/platform_update_rrd.sh +<%= @comment -%>*/5 * * * * root /var/rhizomatica/bin/network_update_rrd.sh +<%= @comment -%>*/1 * * * * root /var/rhizomatica/bin/network_update60.sh #Bind check between OpenBSC and Kannel (disabled) # */10 * * * * root /home/rhizomatica/bin/bind_check.sh