mirror of https://github.com/easzlab/kubeasz.git
修复centos系统重启haproxy启动失败问题
parent
59d8ac5379
commit
321331286e
|
@ -17,8 +17,9 @@
|
|||
- name: 创建haproxy配置目录
|
||||
file: name=/etc/haproxy state=directory
|
||||
|
||||
- name: 创建haproxy工作目录
|
||||
file: name=/run/haproxy state=directory owner=haproxy group=haproxy
|
||||
- name: 修改centos的haproxy.service
|
||||
template: src=haproxy.service.j2 dest=/usr/lib/systemd/system/haproxy.service
|
||||
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
|
||||
|
||||
- name: 配置 haproxy
|
||||
template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg
|
||||
|
@ -48,7 +49,7 @@
|
|||
when: LB_ROLE == "backup"
|
||||
|
||||
- name: 重启haproxy服务
|
||||
shell: systemctl enable haproxy && systemctl restart haproxy
|
||||
shell: systemctl enable haproxy && systemctl daemon-reload && systemctl restart haproxy
|
||||
|
||||
- name: 重启keepalived服务
|
||||
shell: systemctl enable keepalived && systemctl restart keepalived
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=HAProxy Load Balancer
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/sysconfig/haproxy
|
||||
ExecStartPre=/usr/bin/mkdir /run/haproxy
|
||||
ExecStart=/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid $OPTIONS
|
||||
ExecReload=/bin/kill -USR2 $MAINPID
|
||||
KillMode=mixed
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -35,3 +35,4 @@
|
|||
- name: 关闭 selinux
|
||||
shell: "setenforce 0 && echo SELINUX=disabled > /etc/selinux/config"
|
||||
when: ansible_distribution == "CentOS"
|
||||
ignore_errors: true
|
||||
|
|
Loading…
Reference in New Issue