From b144dd44e1f35a6279b39bb1ef134f9edd3cbd83 Mon Sep 17 00:00:00 2001 From: "Wile E. Coyote" Date: Sat, 17 Nov 2018 09:07:16 +0000 Subject: [PATCH] Add scheduling Dramatically reduce the puppet run time and use of resources by not running everything on every run. This will probably need tuning over time... --- modules/rhizo_base/manifests/freeswitch.pp | 2 ++ modules/rhizo_base/manifests/init.pp | 30 ++++++++++++++++++++++ modules/rhizo_base/manifests/openbsc.pp | 1 + modules/rhizo_base/manifests/packages.pp | 3 +++ 4 files changed, 36 insertions(+) diff --git a/modules/rhizo_base/manifests/freeswitch.pp b/modules/rhizo_base/manifests/freeswitch.pp index 714904a..2eff7b6 100644 --- a/modules/rhizo_base/manifests/freeswitch.pp +++ b/modules/rhizo_base/manifests/freeswitch.pp @@ -128,6 +128,7 @@ class rhizo_base::freeswitch::common { 'freeswitch-mod-voicemail', 'freeswitch-mod-voicemail-ivr', 'freeswitch-mod-xml-cdr', 'freeswitch-sysvinit', 'libfreeswitch1']: + schedule => 'onceweek', ensure => installed, require => Class['rhizo_base::apt'], } @@ -191,6 +192,7 @@ class rhizo_base::freeswitch::common { } vcsrepo { '/usr/share/freeswitch/sounds/rccn': + schedule => 'repo', ensure => latest, revision => 'master', provider => git, diff --git a/modules/rhizo_base/manifests/init.pp b/modules/rhizo_base/manifests/init.pp index 69e54ae..f3da951 100644 --- a/modules/rhizo_base/manifests/init.pp +++ b/modules/rhizo_base/manifests/init.pp @@ -187,6 +187,28 @@ class rhizo_base { } } +schedule { 'onceday': + period => daily, + repeat => 1, +} + +schedule { 'onceweek': + period => weekly, + repeat => 1, +} + +schedule { 'weekly': + weekday => 'Sunday', +} + +schedule { 'offpeak': + range => '1 - 4.30', +} + +schedule { 'repo': + range => '1 - 2', +} + #Rizhomatica scripts file { '/home/rhizomatica/bin': ensure => directory, @@ -230,6 +252,7 @@ class rhizo_base { } vcsrepo { '/var/rhizomatica': + schedule => 'repo', ensure => latest, provider => git, source => 'https://github.com/Rhizomatica/rccn.git', @@ -242,6 +265,7 @@ class rhizo_base { } vcsrepo { '/var/meas_web': + schedule => 'repo', ensure => latest, provider => git, source => 'https://github.com/whyteks/meas_web.git', @@ -377,11 +401,13 @@ class rhizo_base { if $operatingsystem == 'Debian' { python::pip { 'twisted': + schedule => 'onceweek', ensure => '13.1.0', pkgname => 'Twisted', } python::pip { 'corepost': + schedule => 'onceweek', ensure => 'present', pkgname => 'CorePost', } @@ -390,21 +416,25 @@ class rhizo_base { python::pip { 'riak': ensure => '2.0.3', pkgname => 'riak', + schedule => 'onceweek', } python::pip { 'gsm0338': ensure => '1.0.0', pkgname => 'gsm0338', + schedule => 'onceweek', } python::pip { 'python-ESL': ensure => 'present', pkgname => 'python-ESL', + schedule => 'onceweek', } python::pip { 'csvkit': ensure => 'present', pkgname => 'csvkit', + schedule => 'onceweek', } file { '/usr/lib/python2.7/dist-packages': diff --git a/modules/rhizo_base/manifests/openbsc.pp b/modules/rhizo_base/manifests/openbsc.pp index e0dae34..5a92511 100644 --- a/modules/rhizo_base/manifests/openbsc.pp +++ b/modules/rhizo_base/manifests/openbsc.pp @@ -46,6 +46,7 @@ class rhizo_base::openbsc::ubuntu inherits rhizo_base::openbsc::common { 'libosmonetif2', 'libosmosim0', 'libosmotrau0']: ensure => purged, + schedule => 'weekly', } } diff --git a/modules/rhizo_base/manifests/packages.pp b/modules/rhizo_base/manifests/packages.pp index 18f7ca6..55415d4 100644 --- a/modules/rhizo_base/manifests/packages.pp +++ b/modules/rhizo_base/manifests/packages.pp @@ -25,6 +25,7 @@ class rhizo_base::packages::common { package { ['mosh', 'git', 'openvpn', 'lm-sensors', 'runit', 'sqlite3', 'libffi-dev', 'apcupsd', 'expect', 'gawk', 'swig', 'g++', 'python-smpplib', 'libcdk5', 'websocketd', 'osmo-meas' ]: + schedule => 'weekly', ensure => installed, require => Class['rhizo_base::apt'], } @@ -44,6 +45,7 @@ class rhizo_base::packages::ubuntu inherits rhizo_base::packages::common { 'php5.6-curl', 'php5.6-cli', 'php5.6-gd', 'python-corepost', 'php5.6-xml', 'python-yaml', 'python-formencode', 'python-unidecode', 'python-dateutil']: + schedule => 'weekly', ensure => installed, require => Class['rhizo_base::apt'], } @@ -65,6 +67,7 @@ class rhizo_base::packages::debian inherits rhizo_base::packages::common { 'python-yaml', 'python-formencode', 'python-unidecode', 'python-dateutil', 'sudo', 'apt-transport-https', 'sngrep' ]: + schedule => 'weekly', ensure => installed, require => Class['rhizo_base::apt'], }