2019-02-07 15:10:49 +08:00
|
|
|
- hosts:
|
2021-04-09 08:35:12 +08:00
|
|
|
- ex-lb
|
2019-02-07 15:10:49 +08:00
|
|
|
tasks:
|
2021-03-27 20:47:03 +08:00
|
|
|
- name: get service info
|
2021-04-09 08:35:12 +08:00
|
|
|
shell: 'systemctl list-units --type=service |grep -E "l4lb|keepalived|ssh"'
|
2021-03-27 20:47:03 +08:00
|
|
|
register: service_info
|
2019-02-07 15:10:49 +08:00
|
|
|
|
2021-04-09 08:35:12 +08:00
|
|
|
- name: remove service l4lb
|
|
|
|
service: name=l4lb state=stopped enabled=no
|
|
|
|
when: '"l4lb" in service_info.stdout'
|
2019-02-07 15:10:49 +08:00
|
|
|
ignore_errors: true
|
|
|
|
|
2021-03-27 20:47:03 +08:00
|
|
|
- name: remove service keepalived
|
|
|
|
service: name=keepalived state=stopped enabled=no
|
|
|
|
when: '"keepalived" in service_info.stdout'
|
2019-02-07 15:10:49 +08:00
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: remove files and dirs
|
|
|
|
file: name={{ item }} state=absent
|
|
|
|
with_items:
|
2021-04-09 08:35:12 +08:00
|
|
|
- "/etc/l4lb"
|
2019-02-07 15:10:49 +08:00
|
|
|
- "/etc/keepalived"
|
2021-04-09 08:35:12 +08:00
|
|
|
- "/etc/systemd/system/l4lb.service"
|
|
|
|
- "/etc/systemd/system/keepalived.service"
|
|
|
|
- "/usr/local/sbin/keepalived"
|