Alexandros Kosiaris has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349170 )

Change subject: Refactor role::icinga slightly
......................................................................

Refactor role::icinga slightly

Remove the implicit lookup hiera keys from the 2 icinga hosts and rely
on the role::icinga::passive key lookup to deduce them from. Remove the
$ircboot parameter from role::icinga to conform more to the puppet code
rules we have. Deduce that variable as well from the above hiera key and
pass it as is to icinga::ircboot class

Change-Id: I2ddd2b752ac9e4689a4a99949475e1e335bfe561
---
M hieradata/hosts/einsteinium.yaml
M hieradata/hosts/tegmen.yaml
M modules/role/manifests/icinga.pp
3 files changed, 22 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/70/349170/1

diff --git a/hieradata/hosts/einsteinium.yaml b/hieradata/hosts/einsteinium.yaml
index e4adcce..4c0eb4a 100644
--- a/hieradata/hosts/einsteinium.yaml
+++ b/hieradata/hosts/einsteinium.yaml
@@ -5,9 +5,6 @@
   - esams.wmnet
   - ulsfo.wmnet
 # Note that our paging infrastructure (AQL as of 20161101) may need an update 
of it's sender whitelist
-icinga::enable_notifications: 1
-icinga::enable_event_handlers: 1
-icinga::ircbot::ensure: present
 role::tcpircbot::ensure: present
 role::icinga::partner: tegmen.wikimedia.org
 role::icinga::passive: false
diff --git a/hieradata/hosts/tegmen.yaml b/hieradata/hosts/tegmen.yaml
index 92702a3..06c5188 100644
--- a/hieradata/hosts/tegmen.yaml
+++ b/hieradata/hosts/tegmen.yaml
@@ -6,9 +6,6 @@
   - ulsfo.wmnet
 # Note that our paging infrastructure (AQL as of 20161101) may need an update 
of it's sender whitelist
 # tegmen is the backup icinga server. All these flags need to be converted 
accordingly for it to assume the identity of the primary
-icinga::enable_notifications: 0
-icinga::enable_event_handlers: 0
-icinga::ircbot::ensure: absent
 role::tcpircbot::ensure: absent
 do_acme: false
 role::icinga::partner: einsteinium.wikimedia.org
diff --git a/modules/role/manifests/icinga.pp b/modules/role/manifests/icinga.pp
index 7e66f78..b8cb6da 100644
--- a/modules/role/manifests/icinga.pp
+++ b/modules/role/manifests/icinga.pp
@@ -8,9 +8,7 @@
 # [*ircbot*]
 #   Setup an ircbot using ircecho to support echoing notifications
 #
-class role::icinga(
-    $ircbot = true,
-){
+class role::icinga {
     include facilities
     include lvs::monitor
     include icinga::monitor::checkpaging
@@ -41,21 +39,37 @@
 
     interface::add_ip6_mapped { 'main': interface => 'eth0' }
 
-    if $ircbot {
-        include icinga::ircbot
-    }
-
     monitoring::service { 'https':
         description   => 'HTTPS',
         check_command => 'check_ssl_http_letsencrypt!icinga.wikimedia.org',
     }
 
-    class { '::icinga':            }
     class { '::icinga::web':       }
     class { '::icinga::naggen':    }
 
     $partner = hiera('role::icinga::partner')
     $is_passive = hiera('role::icinga::passive')
+
+    $ircbot = $is_passive ? {
+        false => 'absent',
+        true  => 'present',
+    }
+    $enable_notifications = $is_passive ? {
+        false => 0,
+        true  => 1,
+    }
+    $enable_event_handlers = $is_passive ? {
+        false => 0,
+        true  => 1,
+    }
+    class { '::icinga':
+        enable_notifications  => $enable_notifications,
+        enable_event_handlers => $enable_event_handlers,
+    }
+    class { '::icinga::ircbot':
+        present => $ircbot,
+    }
+
     include rsync::server
     ferm::service { 'icinga-rsync':
         proto  => 'tcp',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ddd2b752ac9e4689a4a99949475e1e335bfe561
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to