minor fix for cleaning haproxy&keepalived

pull/992/head
gjmzj 2021-02-04 13:54:14 +08:00
parent c3e1984d0d
commit 7a97837901
1 changed files with 12 additions and 5 deletions

View File

@ -1,10 +1,17 @@
# to clean 'lb' service
- block:
- name: rm service keepalived and haproxy
service: name={{ item }} state=stopped enabled=no
with_items:
- keepalived
- haproxy
- 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