Jcrespo has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399359 )

Change subject: haproxy: Update haproxy systemd.unit to that of stretch
......................................................................


haproxy: Update haproxy systemd.unit to that of stretch

Also effectively move the pid from the hardcoded /run to
the one setup by the puppet configuration.

Bug: T183249
Change-Id: Ib129b934b0d2404bfcb71477c9ee77cd9be94314
---
D modules/haproxy/files/haproxy.service
M modules/haproxy/manifests/init.pp
A modules/haproxy/templates/haproxy.service.erb
3 files changed, 22 insertions(+), 21 deletions(-)

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



diff --git a/modules/haproxy/files/haproxy.service 
b/modules/haproxy/files/haproxy.service
deleted file mode 100644
index 459bd5e..0000000
--- a/modules/haproxy/files/haproxy.service
+++ /dev/null
@@ -1,20 +0,0 @@
-[Unit]
-Description=HAProxy Load Balancer
-Documentation=man:haproxy(1)
-Documentation=file:/usr/share/doc/haproxy/configuration.txt.gz
-After=network.target syslog.service
-Wants=syslog.service
-
-[Service]
-Environment=CONFIG=/etc/haproxy/haproxy.cfg
-EnvironmentFile=-/etc/default/haproxy
-ExecStartPre=/usr/local/bin/generate_haproxy_default.sh
-ExecStartPre=/usr/sbin/haproxy -f ${CONFIG} -c -q
-ExecStart=/usr/sbin/haproxy-systemd-wrapper -f ${CONFIG} -p /run/haproxy.pid 
$EXTRAOPTS
-ExecReload=/usr/sbin/haproxy -c -f ${CONFIG}
-ExecReload=/bin/kill -USR2 $MAINPID
-KillMode=mixed
-Restart=always
-
-[Install]
-WantedBy=multi-user.target
diff --git a/modules/haproxy/manifests/init.pp 
b/modules/haproxy/manifests/init.pp
index 598c75f..783286a 100644
--- a/modules/haproxy/manifests/init.pp
+++ b/modules/haproxy/manifests/init.pp
@@ -56,12 +56,13 @@
             source => 'puppet:///modules/haproxy/generate_haproxy_default.sh',
         }
 
+        # TODO: this should use the general systemd puppet abstraction instead
         file { '/lib/systemd/system/haproxy.service':
             ensure  => present,
             mode    => '0644',
             owner   => 'root',
             group   => 'root',
-            source  => 'puppet:///modules/haproxy/haproxy.service',
+            content => template('haproxy/haproxy.service.erb'),
             require => File['/usr/local/bin/generate_haproxy_default.sh'],
             notify  => Exec['/bin/systemctl daemon-reload'],
         }
diff --git a/modules/haproxy/templates/haproxy.service.erb 
b/modules/haproxy/templates/haproxy.service.erb
new file mode 100644
index 0000000..f8cd99e
--- /dev/null
+++ b/modules/haproxy/templates/haproxy.service.erb
@@ -0,0 +1,20 @@
+[Unit]
+Description=HAProxy Load Balancer
+Documentation=man:haproxy(1)
+Documentation=file:/usr/share/doc/haproxy/configuration.txt.gz
+After=network.target syslog.service
+Wants=syslog.service
+
+[Service]
+Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=<%=@pid%>"
+EnvironmentFile=-/etc/default/haproxy
+ExecStartPre=/usr/local/bin/generate_haproxy_default.sh
+ExecStartPre=/usr/sbin/haproxy -f ${CONFIG} -c -q $EXTRAOPTS
+ExecStart=/usr/sbin/haproxy-systemd-wrapper -f ${CONFIG} -p $PIDFILE $EXTRAOPTS
+ExecReload=/usr/sbin/haproxy -f ${CONFIG} -c -q $EXTRAOPTS
+ExecReload=/bin/kill -USR2 $MAINPID
+KillMode=mixed
+Restart=always
+
+[Install]
+WantedBy=multi-user.target

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib129b934b0d2404bfcb71477c9ee77cd9be94314
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Jcrespo <[email protected]>
Gerrit-Reviewer: Jcrespo <[email protected]>
Gerrit-Reviewer: Marostegui <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to