Dzahn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/289340

Change subject: planet: only run updates when in active datacenter
......................................................................

planet: only run updates when in active datacenter

Change-Id: Ib9f1cc485e08f22e3d1c2d5bb2bf1a963e3c3f76
---
M modules/planet/manifests/cronjob.pp
M modules/planet/manifests/init.pp
M modules/role/manifests/planet/venus.pp
3 files changed, 18 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/40/289340/1

diff --git a/modules/planet/manifests/cronjob.pp 
b/modules/planet/manifests/cronjob.pp
index c1a125c..0a2cf2b 100644
--- a/modules/planet/manifests/cronjob.pp
+++ b/modules/planet/manifests/cronjob.pp
@@ -8,8 +8,15 @@
     # randomize the minute crons run, using $title as seed
     $minute = fqdn_rand(60, $title)
 
+    # crons only running if in active datacenter
+    if $planet_active_dc in $domain {
+        cron_ensure => 'present'
+    } else {
+        cron_ensure => 'absent'
+    }
+
     cron { "update-${title}-planet":
-        ensure  => 'present',
+        ensure  => $cron_ensure,
         command => "http_proxy=\"${planet::planet_http_proxy}\" 
https_proxy=\$http_proxy ${planet_bin} -v ${planet_config} > ${planet_logfile} 
2>&1",
         user    => 'planet',
         minute  => $minute,
diff --git a/modules/planet/manifests/init.pp b/modules/planet/manifests/init.pp
index 2673fb5..4ca476a 100644
--- a/modules/planet/manifests/init.pp
+++ b/modules/planet/manifests/init.pp
@@ -13,11 +13,16 @@
 #   see the role class for this
 # $planet_meta_link - a protocol relative link
 #   example: meta.wikimedia.org/wiki/Planet_Wikimedia
+# $planet_http_proxy - set proxy to be used for downloading feeds
+#   example: http://url-downloader.${::site}.wikimedia.org:8080
+# $planet_active_dc - currently active datacenter, updates will only run here
+#   example: eqiad
 class planet (
     $planet_domain_name,
     $planet_languages,
     $planet_meta_link,
     $planet_http_proxy,
+    $planet_active_dc,
 ) {
 
     # locales are essential for planet
diff --git a/modules/role/manifests/planet/venus.pp 
b/modules/role/manifests/planet/venus.pp
index f251410..b6a8fc7 100644
--- a/modules/role/manifests/planet/venus.pp
+++ b/modules/role/manifests/planet/venus.pp
@@ -215,12 +215,16 @@
     # since we are on a private IP now we need to proxy to fetch external URLs
     $planet_http_proxy = "http://url-downloader.${::site}.wikimedia.org:8080";
 
+    # set to the currently active DC. feed updates are only running here.
+    $planet_active_dc = 'eqiad'
+
     # the 'planet' class from modules/planet/init.pp does the setup
     class {'::planet':
         planet_domain_name => $planet_domain_name,
         planet_languages   => $planet_languages,
         planet_meta_link   => $planet_meta_link,
-        planet_http_proxy  => $planet_http_proxy
+        planet_http_proxy  => $planet_http_proxy,
+        planet_active_dc   => $planet_active_dc
     }
 
     ferm::service { 'planet-http':

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9f1cc485e08f22e3d1c2d5bb2bf1a963e3c3f76
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

Reply via email to