Akosiaris has submitted this change and it was merged.

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 manifests/site.pp
M modules/haproxy/manifests/init.pp
R modules/haproxy/templates/haproxy.cfg.erb
5 files changed, 33 insertions(+), 45 deletions(-)

Approvals:
  Akosiaris: Looks good to me, approved
  jenkins-bot: Verified



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..508dbf2
--- /dev/null
+++ b/manifests/role/haproxy.pp
@@ -0,0 +1,9 @@
+class role::haproxy{
+
+    system::role { 'haproxy': description => 'haproxy host' }
+
+    class { 'haproxy':
+        endpoint_hostname => 'palladium',
+        endpoint_ip       => '10.64.16.160',
+    }
+}
diff --git a/manifests/site.pp b/manifests/site.pp
index 3029034..42e1237 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -308,10 +308,8 @@
         backup::client
 
     # set up brewster to use haproxy to proxy puppet
-    # to stafford.
-    class { 'misc::haproxy':
-        config_file =>  'puppet:///files/puppet/haproxy.cfg',
-    }
+    # to palladium.      
+    include role::haproxy        
 }
 
 node "calcium.wikimedia.org" {
diff --git a/modules/haproxy/manifests/init.pp 
b/modules/haproxy/manifests/init.pp
index 5597790..fcc5016 100644
--- a/modules/haproxy/manifests/init.pp
+++ b/modules/haproxy/manifests/init.pp
@@ -1,17 +1,23 @@
-# == 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":
-               ensure => present,
-       }
+class haproxy($endpoint_hostname, $endpoint_ip) {
+    package { 'haproxy':
+        ensure => present,
+    }
 
-       service { "haproxy":
-               ensure     => running,
-               enable     => true,
-               hasstatus  => true,
-               hasrestart => true,
-       }
-}
\ No newline at end of file
+    file { '/etc/haproxy/haproxy.cfg':
+        ensure  => present,
+        mode    => '0444',
+        owner   => 'root',
+        group   => 'root',
+        content => template('haproxy/haproxy.cfg.erb'),
+        notify  => Service['haproxy']
+    }
+
+    service { 'haproxy':
+        ensure     => running,
+        enable     => true,
+        hasstatus  => true,
+        hasrestart => true,
+    }
+}
diff --git a/files/puppet/haproxy.cfg 
b/modules/haproxy/templates/haproxy.cfg.erb
similarity index 88%
rename from files/puppet/haproxy.cfg
rename to modules/haproxy/templates/haproxy.cfg.erb
index 47a5c17..3813616 100644
--- a/files/puppet/haproxy.cfg
+++ b/modules/haproxy/templates/haproxy.cfg.erb
@@ -28,6 +28,5 @@
        bind :8140
        mode tcp
        balance roundrobin
-       #server sockpuppet 10.0.0.245
-       server stafford 10.0.0.24
+    server <%= @endpoint_hostname %> <%= @endpoint_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: merged
Gerrit-Change-Id: Ib55fabd3ef7c5f4e54bd8dc4bf9fe3d7048a1e10
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Matanya <[email protected]>
Gerrit-Reviewer: Akosiaris <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to