Jcrespo has uploaded a new change for review.

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

Change subject: Adding mariadb to labsdb1004 as a slave of labsdb1005
......................................................................

Adding mariadb to labsdb1004 as a slave of labsdb1005

Replication monitoring is not enabled yet

Bug: T88718
Change-Id: I643de5d9fcca2e6f68987821e068ad63fe55298f
---
M manifests/role/labsdb.pp
M manifests/site.pp
R templates/mariadb/tools.my.cnf.erb
3 files changed, 37 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/74/218874/1

diff --git a/manifests/role/labsdb.pp b/manifests/role/labsdb.pp
index ee460ad..fcad172 100644
--- a/manifests/role/labsdb.pp
+++ b/manifests/role/labsdb.pp
@@ -1,9 +1,11 @@
 #include "mysql.db"
 
-class role::labs::db::master {
+class role::labs::db (
+    $role = 'master',
+    ) {
 
     system::role { 'role::labs::db::master':
-        description => 'Labs user database master',
+        description => "Labs user database ${role}",
     }
 
     include standard
@@ -11,12 +13,38 @@
     include role::mariadb::grants
     include role::mariadb::monitor
 
-    class { 'mariadb::config':
-        prompt   => 'TOOLSDB',
-        config   => 'mariadb/toolsmaster.my.cnf.erb',
-        password => $passwords::misc::scripts::mysql_root_pass,
-        datadir  => '/srv/labsdb/data',
-        tmpdir   => '/tmp',
+    $read_only = $role ? {
+        'master' => 'OFF',
+        'slave'  => 'ON',
     }
 
+    class { 'mariadb::config':
+        prompt    => "TOOLSDB ${role}",
+        config    => "mariadb/tools.my.cnf.erb",
+        password  => $passwords::misc::scripts::mysql_root_pass,
+        datadir   => '/srv/labsdb/data',
+        tmpdir    => '/tmp',
+        read_only => $read_only,
+    }
+
+    #unless $role == 'master' {
+    #    mariadb::monitor_replication { 'tools':
+    #        multisource   => false,
+    #        contact_group => 'labs',
+    #    }
+    #}
+
 }
+
+class role::labs::db::master {
+    class { 'role::labs::db':
+        role => 'master',
+    }
+}
+
+class role::labs::db::slave {
+    class { 'role::labs::db':
+        role => 'slave',
+    }
+}
+
diff --git a/manifests/site.pp b/manifests/site.pp
index 8259bf7..4116de0 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -1313,7 +1313,7 @@
 
     include role::postgres::master
     include role::postgres::maps
-    # role labs::db::slave
+    role labs::db::slave
 }
 
 node 'labsdb1005.eqiad.wmnet' {
diff --git a/templates/mariadb/toolsmaster.my.cnf.erb 
b/templates/mariadb/tools.my.cnf.erb
similarity index 100%
rename from templates/mariadb/toolsmaster.my.cnf.erb
rename to templates/mariadb/tools.my.cnf.erb

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I643de5d9fcca2e6f68987821e068ad63fe55298f
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Jcrespo <[email protected]>

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

Reply via email to