From 8578142170b3bc71bd5edd18b114bb64791a3e7c Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Mon, 7 Apr 2025 22:45:05 +0800 Subject: [PATCH] refactor(k3s-cluster): use synchronize to run scripts --- .../roles/vhosts/k3s-cluster/tasks/main.yml | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/roles/vhosts/k3s-cluster/tasks/main.yml b/ansible/playbooks/roles/vhosts/k3s-cluster/tasks/main.yml index b0166a63..e1f97777 100644 --- a/ansible/playbooks/roles/vhosts/k3s-cluster/tasks/main.yml +++ b/ansible/playbooks/roles/vhosts/k3s-cluster/tasks/main.yml @@ -1,6 +1,30 @@ --- +- name: Sync install_k3s.sh to remote + synchronize: + src: files/install_k3s.sh + dest: /tmp/install_k3s.sh + mode: push + delegate_to: localhost + +- name: Sync set-registry.sh to remote + synchronize: + src: files/set-registry.sh + dest: /tmp/set-registry.sh + mode: push + delegate_to: localhost + +- name: Ensure install_k3s.sh is executable + file: + path: /tmp/install_k3s.sh + mode: '0755' + +- name: Ensure set-registry.sh is executable + file: + path: /tmp/set-registry.sh + mode: '0755' + - name: Run install_k3s.sh - script: install_k3s.sh + command: /tmp/install_k3s.sh - name: Run set-registry.sh - script: set-registry.sh + command: /tmp/set-registry.sh