kubeasz/roles/clean/tasks/clean_lb.yml

23 lines
713 B
YAML

# to clean 'lb' service
- block:
- 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"
when: "inventory_hostname in groups['kube_node'] or inventory_hostname in groups['ex_lb']"