Matanya has uploaded a new change for review.
https://gerrit.wikimedia.org/r/96759
Change subject: haproxy: get rid of misc, add a role and template
......................................................................
haproxy: get rid of misc, add a role and template
the haproxy module was not managing the config file, moved it into a template
and added a role for it.
Change-Id: Ib55fabd3ef7c5f4e54bd8dc4bf9fe3d7048a1e10
---
D manifests/misc/haproxy.pp
A manifests/role/haproxy.pp
M modules/haproxy/manifests/init.pp
R modules/haproxy/templates/haproxy.erb
4 files changed, 22 insertions(+), 34 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/59/96759/1
diff --git a/manifests/misc/haproxy.pp b/manifests/misc/haproxy.pp
deleted file mode 100644
index 5b2af47..0000000
--- a/manifests/misc/haproxy.pp
+++ /dev/null
@@ -1,24 +0,0 @@
-# haproxy (RT-4660)
-
-class misc::haproxy($config_file = undef) {
-
- system::role { 'misc::haproxy': description => 'haproxy host' }
-
- package { 'haproxy': ensure => present; }
-
- service { haproxy:
- ensure => running,
- require => Package['haproxy'],
- }
-
- if ($config_file) {
- file { '/etc/haproxy/haproxy.cfg':
- ensure => present,
- mode => '0444',
- owner => 'root',
- group => 'root',
- source => $config_file,
- notify => Service['haproxy'],
- }
- }
-}
diff --git a/manifests/role/haproxy.pp b/manifests/role/haproxy.pp
new file mode 100644
index 0000000..61cd1eb
--- /dev/null
+++ b/manifests/role/haproxy.pp
@@ -0,0 +1,5 @@
+class role::haproxy{
+ system::role { 'haproxy': description => 'haproxy host' }
+
+ include haproxy
+}
diff --git a/modules/haproxy/manifests/init.pp
b/modules/haproxy/manifests/init.pp
index 5597790..8a973a9 100644
--- a/modules/haproxy/manifests/init.pp
+++ b/modules/haproxy/manifests/init.pp
@@ -1,17 +1,25 @@
-# == Class haproxy
+# Class haproxy
# Installs haproxy and ensures that it is running.
-# Note: This class does not currently manage haproxy.cfg.
-#
-class haproxy
-{
- package { "haproxy":
+class haproxy{
+ system::role { 'haproxy': description => 'haproxy host' }
+
+ package { 'haproxy':
ensure => present,
+
+ }
+ file { '/etc/haproxy/haproxy.cfg':
+ ensure => present,
+ mode => '0444',
+ owner => 'root',
+ group => 'root',
+ content => template('haproxy/haproxy.erb'),
+ notify => Service['haproxy'],
}
- service { "haproxy":
+ service { 'haproxy':
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
}
-}
\ No newline at end of file
+}
diff --git a/files/puppet/haproxy.cfg b/modules/haproxy/templates/haproxy.erb
similarity index 88%
rename from files/puppet/haproxy.cfg
rename to modules/haproxy/templates/haproxy.erb
index 47a5c17..f69e721 100644
--- a/files/puppet/haproxy.cfg
+++ b/modules/haproxy/templates/haproxy.erb
@@ -28,6 +28,5 @@
bind :8140
mode tcp
balance roundrobin
- #server sockpuppet 10.0.0.245
- server stafford 10.0.0.24
+ server <%= host %> <%=ip %>
acl esams src 91.198.174.0/24
--
To view, visit https://gerrit.wikimedia.org/r/96759
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib55fabd3ef7c5f4e54bd8dc4bf9fe3d7048a1e10
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Matanya <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits