kubeasz/roles/clean/tasks/clean_lb.yml

26 lines
776 B
YAML
Raw Normal View History

2019-06-02 00:04:33 +08:00
# to clean 'lb' service
- block:
- name: get service info
2021-04-09 08:35:12 +08:00
shell: 'systemctl list-units --type=service |grep -E "l4lb|keepalived|ssh"'
register: service_info
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'
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:
2021-04-09 08:35:12 +08:00
- "/etc/l4lb"
2019-06-02 00:04:33 +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"
when: "inventory_hostname in groups['ex_lb']"