File tree 6 files changed +56
-9
lines changed
6 files changed +56
-9
lines changed Original file line number Diff line number Diff line change 16
16
package :
17
17
name : " {{ haproxy_extra_packages }}"
18
18
19
- - name : ' Enable it'
20
- service :
21
- name : haproxy
22
- enabled : yes
23
-
24
19
- name : ' Ensure chroot directory exists'
25
20
file :
26
21
name : " {{ haproxy_global.chroot }}"
Original file line number Diff line number Diff line change 1
1
---
2
- - name : Add haproxy apt repo (jessie)
2
+ - name : Debian - Ensure haproxy apt repo is added.
3
3
apt_repository :
4
4
repo : " deb http://http.debian.net/debian {{ ansible_distribution_release }} main"
5
5
state : present
6
6
update_cache : yes
7
- when : ansible_distribution_release == 'jessie'
8
7
9
- - name : Install HAProxy (jessie)
8
+ - name : Debian - Ensure HAProxy is installed.
10
9
apt :
11
10
name : " {{ haproxy_package_name }}"
12
11
default_release : " {{ ansible_distribution_release }}"
13
- when : ansible_distribution_release == 'jessie'
Original file line number Diff line number Diff line change 1
1
---
2
2
- include : install.yml
3
3
4
+ - include : systemd.yml
5
+ when : ansible_service_mgr == "systemd"
6
+
7
+ - include : service.yml
8
+
4
9
- include : configure.yml
5
10
when : haproxy_manage_config
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Service - Ensure service is enabled.
3
+ service :
4
+ name : haproxy
5
+ enabled : yes
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Systemd - Ensure service script is present.
3
+ become : true
4
+ template :
5
+ src : " haproxy.systemd.j2"
6
+ dest : " /lib/systemd/system/haproxy.service"
7
+ owner : root
8
+ group : root
9
+ mode : 0755
10
+ register : systemd_service_file
11
+ notify : restart haproxy
12
+
13
+ - name : Systemd - Ensure service is linked into /etc/systemd.
14
+ file :
15
+ src : " /lib/systemd/system/haproxy.service"
16
+ dest : " /etc/systemd/system/multi-user.target.wants/haproxy.service"
17
+ state : link
18
+
19
+ #
20
+ # Keep systemd-specific bits here instead of pushing a global handler.
21
+ #
22
+ - name : Systemd - Ensure systemd daemon is reloaded.
23
+ systemd :
24
+ daemon_reload : yes
25
+ when : systemd_service_file.changed
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description=HAProxy Load Balancer
3
+ Documentation=man:haproxy(1)
4
+ Documentation=file:/usr/share/doc/haproxy/configuration.txt.gz
5
+ After=network.target syslog.service
6
+ Wants=syslog.service
7
+
8
+ [Service]
9
+ Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid"
10
+ EnvironmentFile=-/etc/default/haproxy
11
+ ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS
12
+ ExecStart=/usr/sbin/haproxy-systemd-wrapper -f $CONFIG -p $PIDFILE $EXTRAOPTS
13
+ ExecReload=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS
14
+ ExecReload=/bin/kill -USR2 $MAINPID
15
+ KillMode=mixed
16
+ Restart=always
17
+
18
+ [Install]
19
+ WantedBy=multi-user.target
You can’t perform that action at this time.
0 commit comments