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

23 lines
615 B
YAML

- hosts:
- ex_lb
tasks:
- 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'
ignore_errors: true
- name: remove files and dirs
file: name={{ item }} state=absent
with_items:
- "/etc/haproxy"
- "/etc/keepalived"