kubeasz/roles/ex-lb/clean-ex-lb.yml

23 lines
615 B
YAML
Raw Normal View History

2019-02-07 15:10:49 +08:00
- hosts:
- ex_lb
2019-02-07 15:10:49 +08:00
tasks:
2021-03-27 20:47:03 +08:00
- name: get service info
shell: 'systemctl list-units --type=service |grep -E "haproxy|keepalived|ssh"'
register: service_info
2019-02-07 15:10:49 +08:00
2021-03-27 20:47:03 +08:00
- name: remove service haproxy
service: name=haproxy state=stopped enabled=no
when: '"haproxy" 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:
- "/etc/haproxy"
- "/etc/keepalived"