zhong (钟鹏群) hai 1 mes
pai
achega
3b9b4962a3
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      cluster-setup/ansible-files/install-k3s-master.yml

+ 5 - 4
cluster-setup/ansible-files/install-k3s-master.yml

@@ -22,13 +22,14 @@
       ignore_errors: yes
 
     - name: Check for running k3s processes
-      shell: pgrep -f k3s || true
-      register: k3s_processes
+      shell: ps aux | grep '[k]3s' | awk '{print $2}' || true
+      register: k3s_pids
       changed_when: false
 
     - name: Kill running k3s processes if any exist
-      shell: pkill -f k3s
-      when: k3s_processes.stdout != ""
+      shell: "kill {{ item }}"
+      loop: "{{ k3s_pids.stdout_lines }}"
+      when: k3s_pids.stdout != ""
       ignore_errors: yes
 
     - name: Remove k3s service file