BBlack has uploaded a new change for review.

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

Change subject: vhtcpd: refac args template, allow multiple mc addrs
......................................................................

vhtcpd: refac args template, allow multiple mc addrs

Bug: T116752
Change-Id: Icc0497e2fe8330ed5a451ecc384bd78e719816e0
---
M modules/role/manifests/cache/maps.pp
M modules/role/manifests/cache/mobile.pp
M modules/role/manifests/cache/text.pp
M modules/role/manifests/cache/upload.pp
M modules/varnish/manifests/htcppurger.pp
A modules/varnish/templates/vhtcpd-default.erb
6 files changed, 15 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/17/249117/1

diff --git a/modules/role/manifests/cache/maps.pp 
b/modules/role/manifests/cache/maps.pp
index 51548c5..5c9f396 100644
--- a/modules/role/manifests/cache/maps.pp
+++ b/modules/role/manifests/cache/maps.pp
@@ -3,7 +3,8 @@
         description => 'maps Varnish cache server',
     }
 
-    class { 'varnish::htcppurger': varnish_instances => [ '127.0.0.1:80', 
'127.0.0.1:3128' ] }
+    class { 'varnish::htcppurger':
+    }
 
     include role::cache::2layer
 
diff --git a/modules/role/manifests/cache/mobile.pp 
b/modules/role/manifests/cache/mobile.pp
index 105f983..cdc4280 100644
--- a/modules/role/manifests/cache/mobile.pp
+++ b/modules/role/manifests/cache/mobile.pp
@@ -3,7 +3,8 @@
         description => 'mobile Varnish cache server',
     }
 
-    class { 'varnish::htcppurger': varnish_instances => [ '127.0.0.1:80', 
'127.0.0.1:3128' ] }
+    class { 'varnish::htcppurger':
+    }
 
     include role::cache::2layer
 
diff --git a/modules/role/manifests/cache/text.pp 
b/modules/role/manifests/cache/text.pp
index 422bde7..bc7d7ac 100644
--- a/modules/role/manifests/cache/text.pp
+++ b/modules/role/manifests/cache/text.pp
@@ -3,7 +3,8 @@
         description => 'text Varnish cache server',
     }
 
-    class { 'varnish::htcppurger': varnish_instances => [ '127.0.0.1:80', 
'127.0.0.1:3128' ] }
+    class { 'varnish::htcppurger':
+    }
 
     include role::cache::2layer
 
diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index aeb1cbf..55ab7cb 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -3,7 +3,8 @@
         description => 'upload Varnish cache server',
     }
 
-    class { 'varnish::htcppurger': varnish_instances => [ '127.0.0.1:80', 
'127.0.0.1:3128' ] }
+    class { 'varnish::htcppurger':
+    }
 
     include role::cache::2layer
 
diff --git a/modules/varnish/manifests/htcppurger.pp 
b/modules/varnish/manifests/htcppurger.pp
index 1ba376c..d4543b2 100644
--- a/modules/varnish/manifests/htcppurger.pp
+++ b/modules/varnish/manifests/htcppurger.pp
@@ -1,4 +1,7 @@
-class varnish::htcppurger($varnish_instances=['localhost:80']) {
+class varnish::htcppurger(
+    $varnishes = [ 'localhost:80', 'localhost:3128' ],
+    $mc_addrs  = [ '239.128.0.112' ],
+) {
     Class[varnish::packages] -> Class[varnish::htcppurger]
 
     package { 'vhtcpd':
@@ -9,9 +12,8 @@
         owner   => 'root',
         group   => 'root',
         mode    => '0444',
-        require => Package['vhtcpd'], # if we go first, we get overwritten
-        # TODO: -r ^upload\\.wikimedia\\.org\$ (POSIX ERE, new param for 
class, quoting/escaping will be tricky...)
-        content => inline_template('DAEMON_OPTS="-m 239.128.0.112<% 
@varnish_instances.each do |inst| -%> -c <%= inst %><% end -%>"'),
+        require => Package['vhtcpd'],
+        content => template('varnish/vhtcpd-default.erb'),
     }
 
     service { 'vhtcpd':
diff --git a/modules/varnish/templates/vhtcpd-default.erb 
b/modules/varnish/templates/vhtcpd-default.erb
new file mode 100644
index 0000000..13717b4
--- /dev/null
+++ b/modules/varnish/templates/vhtcpd-default.erb
@@ -0,0 +1 @@
+DAEMON_OPTS="-m <% @mc_addrs.join(' -m ') %> -c <% @varnishes.join(' -c ') %>"

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

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

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

Reply via email to