Alexandros Kosiaris has uploaded a new change for review.

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

Change subject: ores: define slaveof as a parameter
......................................................................

ores: define slaveof as a parameter

Bug: T124200
Change-Id: I3b77167c105127fe9ccb410c337444423c6a7873
---
M modules/ores/manifests/redis.pp
1 file changed, 26 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/43/278243/1

diff --git a/modules/ores/manifests/redis.pp b/modules/ores/manifests/redis.pp
index 45f6f76..989adec 100644
--- a/modules/ores/manifests/redis.pp
+++ b/modules/ores/manifests/redis.pp
@@ -1,6 +1,7 @@
 class ores::redis(
     $queue_maxmemory,
     $cache_maxmemory,
+    $slaveof=undef,
 ) {
     file { [
         '/srv/redis/queue',
@@ -12,6 +13,30 @@
         mode   => '0774'
     }
 
+    $premap = {
+        '6379' => {
+            dir       => '/srv/redis/queue',
+            maxmemory => $queue_maxmemory,
+        },
+        '6380' => {
+            dir       => '/srv/redis/cache',
+            maxmemory => $cache_maxmemory,
+        },
+    }
+    if $slaveof {
+        $slave_map = {
+            '6379' => {
+                slaveof   => "${slaveof} 6379",
+            },
+            '6380' => {
+                slaveof   => "${slaveof} 6380",
+            },
+        }
+        $map = deep_merge($slave_map, $premap)
+    } else {
+        $map = $premap
+    }
+
     # FIXME: Tune the individual redises better for their use case
     # queue: 6379, cache: 6380
     redis::instance { ['6379', '6380']:
@@ -19,16 +44,7 @@
             bind          => '0.0.0.0',
             tcp_keepalive => 60,
         },
-        map => {
-            '6379' => {
-                dir       => '/srv/redis/queue',
-                maxmemory => $queue_maxmemory,
-            },
-            '6380' => {
-                dir       => '/srv/redis/cache',
-                maxmemory => $cache_maxmemory,
-            },
-        },
+        map => $map,
         require => [
             File['/srv/redis/queue'],
             File['/srv/redis/cache'],

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

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

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

Reply via email to