Pyoungmeister has submitted this change and it was merged.

Change subject: setting up terbium, eqiad hume-ish host
......................................................................


setting up terbium, eqiad hume-ish host

this also meant parameterizing all of the misc:maint classes. they
should default to the primary_site. for now, they are all set
explicitly, as we are not using terbium yet.

the ability to set explicitly will also be helpful if the maint
host in the primary site dies.

Change-Id: Iffd8a7cd2fa72705ab4a02ad57b7589e2f8c2d02
---
M manifests/misc/maintenance.pp
M manifests/site.pp
2 files changed, 141 insertions(+), 43 deletions(-)

Approvals:
  Pyoungmeister: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/misc/maintenance.pp b/manifests/misc/maintenance.pp
index 8ee57aa..37c9e32 100644
--- a/manifests/misc/maintenance.pp
+++ b/manifests/misc/maintenance.pp
@@ -2,7 +2,7 @@
 
 # mw maintenance/batch hosts
 
-class misc::maintenance::foundationwiki {
+class misc::maintenance::foundationwiki( $enabled = inline_template("<%= 
$::site == $::primary_site  %>") ) {
 
        system_role { "misc::maintenance::foundationwiki": description => "Misc 
- Maintenance Server: foundationwiki" }
 
@@ -10,18 +10,26 @@
                user => apache,
                minute => '*/15',
                command => '/usr/local/bin/mwscript 
extensions/ContributionReporting/PopulateFundraisingStatistics.php 
foundationwiki --op updatedays > 
/tmp/PopulateFundraisingStatistics-updatedays.log',
-               ensure => present,
+               ensure => $enabled ?{
+                       true => present,
+                       false => absent,
+                       default => absent
+               };
        }
 
        cron { 'populatefundraisers':
                user => apache,
                minute => 5,
                command => '/usr/local/bin/mwscript 
extensions/ContributionReporting/PopulateFundraisingStatistics.php 
foundationwiki --op populatefundraisers > 
/tmp/PopulateFundraisingStatistics-populatefundraisers.log',
-               ensure => present,
+               ensure => $enabled ?{
+                       true => present,
+                       false => absent,
+                       default => absent
+               };
        }
 }
 
-class misc::maintenance::refreshlinks {
+class misc::maintenance::refreshlinks( $enabled = inline_template("<%= $::site 
== $::primary_site  %>") ) {
 
        require mediawiki
 
@@ -34,7 +42,7 @@
                mode => 0664,
        }
 
-       define cronjob() {
+       define cronjob( $cronenabled = $enabled ) {
 
                $cluster = regsubst($name, '@.*', '\1')
                $monthday = regsubst($name, '.*@', '\1')
@@ -45,7 +53,11 @@
                        hour => 0,
                        minute => 0,
                        monthday => $monthday,
-                       ensure => present,
+                       ensure => $cronenabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
                }
        }
 
@@ -53,7 +65,7 @@
        cronjob { ['s2@2', 's3@3', 's4@4', 's5@5', 's6@6', 's7@7']: }
 }
 
-class misc::maintenance::pagetriage {
+class misc::maintenance::pagetriage( $enabled = inline_template("<%= $::site 
== $::primary_site  %>") ) {
 
        system_role { "misc::maintenance::pagetriage": description => "Misc - 
Maintenance Server: pagetriage extension" }
 
@@ -63,7 +75,11 @@
                hour => 20,
                monthday => '*/2',
                command => '/usr/local/bin/mwscript 
extensions/PageTriage/cron/updatePageTriageQueue.php enwiki > 
/tmp/updatePageTriageQueue.en.log',
-               ensure => present,
+               ensure => $enabled ?{
+                       true => present,
+                       false => absent,
+                       default => absent
+               };
        }
 
        cron { 'pagetriage_cleanup_testwiki':
@@ -72,11 +88,15 @@
                hour => 14,
                monthday => '*/2',
                command => '/usr/local/bin/mwscript 
extensions/PageTriage/cron/updatePageTriageQueue.php testwiki > 
/tmp/updatePageTriageQueue.test.log',
-               ensure => present,
+               ensure => $enabled ?{
+                       true => present,
+                       false => absent,
+                       default => absent
+               };
        }
 }
 
-class misc::maintenance::translationnotifications {
+class misc::maintenance::translationnotifications( $enabled = 
inline_template("<%= $::site == $::primary_site  %>") ) {
        require misc::deployment::scripts
 
        # Should there be crontab entry for each wiki,
@@ -89,7 +109,11 @@
                        weekday => 1, # Monday
                        hour => 10,
                        minute => 0,
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
 
                translationnotifications-mediawikiwiki:
                        command => "/usr/local/bin/mwscript 
extensions/TranslationNotifications/scripts/DigestEmailer.php --wiki 
mediawikiwiki 2>&1 >> /var/log/translationnotifications/digests.log",
@@ -97,7 +121,11 @@
                        weekday => 1, # Monday
                        hour => 10,
                        minute => 5,
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 
        file {
@@ -112,28 +140,36 @@
        }
 }
 
-class misc::maintenance::tor_exit_node {
+class misc::maintenance::tor_exit_node( $enabled = inline_template("<%= 
$::site == $::primary_site  %>") ) {
        cron {
                tor_exit_node_update:
                        command => "php 
/home/wikipedia/common/multiversion/MWScript.php 
extensions/TorBlock/loadExitNodes.php aawiki --force > /dev/null",
                        user => apache,
                        minute => '*/20',
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 }
 
-class misc::maintenance::echo_mail_batch {
+class misc::maintenance::echo_mail_batch( $enabled = inline_template("<%= 
$::site == $::primary_site  %>") ) {
        cron {
                echo_mail_batch:
                        command => "/usr/local/bin/mwscript 
extensions/Echo/processEchoEmailBatch.php testwiki",
                        user => apache,
                        minute => 0,
                        hour => 0,
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 }
 
-class misc::maintenance::update_flaggedrev_stats{
+class misc::maintenance::update_flaggedrev_stats( $enabled = 
inline_template("<%= $::site == $::primary_site  %>") ) {
        file {
                
"/home/wikipedia/common/php/extensions/FlaggedRevs/maintenance/wikimedia-periodic-update.sh":
                        source => 
"puppet:///files/misc/scripts/wikimedia-periodic-update.sh",
@@ -149,22 +185,30 @@
                        user => "apache",
                        hour => "*/2",
                        minute => "0",
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 }
 
-class misc::maintenance::cleanup_upload_stash {
+class misc::maintenance::cleanup_upload_stash( $enabled = inline_template("<%= 
$::site == $::primary_site  %>") ) {
        cron {
                cleanup_upload_stash:
                        command => "/usr/local/bin/foreachwiki 
maintenance/cleanupUploadStash.php > /dev/null",
                        user => "apache",
                        hour => 1,
                        minute => 0,
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 }
 
-class misc::maintenance::update_special_pages {
+class misc::maintenance::update_special_pages( $enabled = inline_template("<%= 
$::site == $::primary_site  %>") ) {
        cron {
                update_special_pages:
                        command => "flock -n /var/lock/update-special-pages 
/usr/local/bin/update-special-pages > 
/home/wikipedia/logs/norotate/updateSpecialPages.log 2>&1",
@@ -172,7 +216,11 @@
                        monthday => "*/3",
                        hour => 5,
                        minute => 0,
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
                update_special_pages_small:
                        ensure => absent;
        }
@@ -189,13 +237,17 @@
        }
 }
 
-class misc::maintenance::wikidata {
+class misc::maintenance::wikidata( $enabled = inline_template("<%= $::site == 
$::primary_site  %>") ) {
        cron {
                wikibase-repo-prune:
                        command => "/usr/local/bin/mwscript 
extensions/Wikibase/repo/maintenance/pruneChanges.php --wiki wikidatawiki 
--number-of-days=1 2>&1 >> /var/log/wikidata/prune.log",
                        user => mwdeploy,
                        minute => [0,15,30,45],
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 
        # Run the dispatcher script every 5 minutes
@@ -205,7 +257,11 @@
                        command => "/usr/local/bin/mwscript 
extensions/Wikibase/lib/maintenance/dispatchChanges.php --wiki wikidatawiki 
--max-time 300 2>&1 >> /var/log/wikidata/dispatcher.log",
                        user => mwdeploy,
                        minute => "*/5",
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 
     cron {
@@ -213,7 +269,11 @@
                        command => "/usr/local/bin/mwscript 
extensions/Wikibase/lib/maintenance/dispatchChanges.php --wiki wikidatawiki 
--max-time 420 2>&1 >> /var/log/wikidata/dispatcher2.log",
                        user => mwdeploy,
                        minute => "*/7",
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 
        cron {
@@ -238,7 +298,7 @@
        }
 }
 
-class misc::maintenance::parsercachepurging {
+class misc::maintenance::parsercachepurging( $enabled = inline_template("<%= 
$::site == $::primary_site  %>") ) {
 
        system_role { "misc::maintenance::parsercachepurging": description => 
"Misc - Maintenance Server: parser cache purging" }
 
@@ -249,12 +309,16 @@
                weekday => 0,
                # Purge entries older than 30d * 86400s/d = 2592000s
                command => '/usr/local/bin/mwscript purgeParserCache.php 
--wiki=aawiki --age=2592000 >/dev/null 2>&1',
-               ensure => present,
+               ensure => $enabled ?{
+                       true => present,
+                       false => absent,
+                       default => absent
+               };
        }
 
 }
 
-class misc::maintenance::geodata {
+class misc::maintenance::geodata( $enabled = inline_template("<%= $::site == 
$::primary_site  %>") ) {
        file {
                "/usr/local/bin/update-geodata":
                        ensure => present,
@@ -271,13 +335,21 @@
                        command => "/usr/local/bin/update-geodata >/dev/null",
                        user => apache,
                        minute => "*/30",
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
                "clear-killlist":
                        command => "/usr/local/bin/clear-killlist >/dev/null",
                        user => apache,
                        hour => 8,
                        minute => 45,
-                       ensure => present;
+                       ensure => $enabled ?{
+                               true => present,
+                               false => absent,
+                               default => absent
+                       };
        }
 }
 
diff --git a/manifests/site.pp b/manifests/site.pp
index b3a6b7c..072c5ab 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -963,22 +963,23 @@
                nfs::netapp::home,
                nfs::upload,
                misc::deployment::scap_scripts,
-               misc::maintenance::foundationwiki,
-               misc::maintenance::pagetriage,
-               misc::maintenance::refreshlinks,
-               misc::maintenance::translationnotifications,
-               misc::maintenance::wikidata,
-               misc::maintenance::tor_exit_node,
-               misc::maintenance::echo_mail_batch,
-               misc::maintenance::update_flaggedrev_stats,
-               misc::maintenance::update_special_pages,
-               misc::maintenance::parsercachepurging,
-               misc::maintenance::geodata,
-               misc::maintenance::cleanup_upload_stash,
                admins::roots,
                admins::mortals,
                admins::restricted,
                nrpe
+
+       class { misc::maintenance::foundationwiki: enabled => true }
+       class { misc::maintenance::pagetriage: enabled => true }
+       class { misc::maintenance::refreshlinks: enabled => true }
+       class { misc::maintenance::translationnotifications: enabled => true }
+       class { misc::maintenance::wikidata: enabled => true }
+       class { misc::maintenance::tor_exit_node: enabled => true }
+       class { misc::maintenance::echo_mail_batch: enabled => true }
+       class { misc::maintenance::update_flaggedrev_stats: enabled => true }
+       class { misc::maintenance::update_special_pages: enabled => true }
+       class { misc::maintenance::parsercachepurging: enabled => true }
+       class { misc::maintenance::geodata: enabled => true }
+       class { misc::maintenance::cleanup_upload_stash: enabled => true }
 
 }
 
@@ -2468,6 +2469,31 @@
                groups::wikidev
 }
 
+node "terbium.eqiad.wmnet" {
+       include role::applicationserver::maintenance,
+               nfs::netapp::home,
+               nfs::upload,
+               misc::deployment::scap_scripts,
+               admins::roots,
+               admins::mortals,
+               admins::restricted,
+               nrpe
+
+       class { misc::maintenance::foundationwiki: enabled => false }
+       class { misc::maintenance::pagetriage: enabled => false }
+       class { misc::maintenance::refreshlinks: enabled => false }
+       class { misc::maintenance::translationnotifications: enabled => false }
+       class { misc::maintenance::wikidata: enabled => false }
+       class { misc::maintenance::tor_exit_node: enabled => false }
+       class { misc::maintenance::echo_mail_batch: enabled => false }
+       class { misc::maintenance::update_flaggedrev_stats: enabled => false }
+       class { misc::maintenance::update_special_pages: enabled => false }
+       class { misc::maintenance::parsercachepurging: enabled => false }
+       class { misc::maintenance::geodata: enabled => false }
+       class { misc::maintenance::cleanup_upload_stash: enabled => false }
+
+}
+
 node "tin.eqiad.wmnet" {
        $cluster = "misc"
        $domain_search = "wikimedia.org pmtpa.wmnet eqiad.wmnet 
esams.wikimedia.org"

-- 
To view, visit https://gerrit.wikimedia.org/r/55155
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iffd8a7cd2fa72705ab4a02ad57b7589e2f8c2d02
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Pyoungmeister <[email protected]>
Gerrit-Reviewer: Pyoungmeister <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to