2019-06-02 00:04:33 +08:00
|
|
|
# to clean 'lb' service
|
|
|
|
- block:
|
2021-02-04 13:54:14 +08:00
|
|
|
- name: get service info
|
|
|
|
shell: 'systemctl list-units --type=service |grep -E "haproxy|keepalived|ssh"'
|
|
|
|
register: service_info
|
|
|
|
|
|
|
|
- name: remove service haproxy
|
|
|
|
service: name=haproxy state=stopped enabled=no
|
|
|
|
when: '"haproxy" in service_info.stdout'
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: remove service keepalived
|
|
|
|
service: name=keepalived state=stopped enabled=no
|
|
|
|
when: '"keepalived" in service_info.stdout'
|
2019-06-02 00:04:33 +08:00
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: remove files and dirs
|
|
|
|
file: name={{ item }} state=absent
|
|
|
|
with_items:
|
|
|
|
- "/etc/haproxy"
|
|
|
|
- "/etc/keepalived"
|
2021-01-19 17:41:00 +08:00
|
|
|
when: "inventory_hostname in groups['kube_node'] or inventory_hostname in groups['ex_lb']"
|