diff --git a/ezctl b/ezctl index 049e7cb..66372af 100755 --- a/ezctl +++ b/ezctl @@ -110,18 +110,19 @@ function usage-setup(){ echo -e "\033[33mUsage:\033[0m ezctl setup " cat < 0" + - name: get service info + shell: 'systemctl list-units --type=service |grep -E "haproxy|keepalived|ssh"' + register: service_info - - name: stop keepalived service - service: name=keepalived state=stopped enabled=no + - name: remove service haproxy + service: name=haproxy state=stopped enabled=no + when: '"haproxy" in service_info.stdout' ignore_errors: true - - name: stop haproxy service - service: name=haproxy state=stopped enabled=no + - 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 @@ -26,11 +20,3 @@ with_items: - "/etc/haproxy" - "/etc/keepalived" - - - name: clean 'ENV PATH' - lineinfile: - dest: ~/.bashrc - state: absent - regexp: '{{ item }}' - with_items: - - 'kubeasz'