# Restart HAProxy with Puppet managed installation

**URL:** <https://discourse.haproxy.org/t/restart-haproxy-with-puppet-managed-installation/4411>\
**Category:** Help!\
**Created:** [October 21, 2019, 3:22pm UTC](https://discourse.haproxy.org/t/restart-haproxy-with-puppet-managed-installation/4411 "2019-10-21T15:22:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![moscardo](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@moscardo](https://discourse.haproxy.org/u/moscardo)\
**Post date:** [October 21, 2019, 3:22pm UTC](https://discourse.haproxy.org/t/restart-haproxy-with-puppet-managed-installation/4411/1 "2019-10-21T15:22:06Z")

</div>

Hi,  
I am managing my HAProxy configurations through Puppet module and it seems that when there is a modification it sends a Notify[Service] which turns into “systemctl restart haproxy”. I am not sure why they don’t do reload instead… However I need to dump the status of the servers before restarting it, let’s say I have 1 node in drain, after the restart without saving the state this node will come back online.  
Any suggestion ? Is it safe to do restart when changing a configuration?

Here is the systemd file in case someon can help:

```auto
[Unit]
Description=HAProxy Load Balancer
After=network.target

[Service]
Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid"
EnvironmentFile=-/etc/sysconfig/haproxy
ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q
ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $OPTIONS
ExecReload=/usr/sbin/haproxy -f $CONFIG -c -q
ExecReload=/etc/haproxy/server-state/update-servers-status.sh
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed
Type=notify

[Install]
WantedBy=multi-user.target

```

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [October 21, 2019, 7:43pm UTC](https://discourse.haproxy.org/t/restart-haproxy-with-puppet-managed-installation/4411/2 "2019-10-21T19:43:18Z")

</div>

You need to configure [server-state-file](https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#3.1-server-state-file) pointing to the file and adjust the system unit to dump the state to that file:

> <https://serverfault.com/questions/908380/always-save-haproxy-server-state-before-stop>
