iac_modules/ansible/playbooks/roles/vhosts/k3s-cluster/tasks/main.yml
Haitao Pan 429c2ace22 refactor(k3s-cluster):
- move setup scripts to user tmp dir for safer execution
2025-04-07 23:41:11 +08:00

45 lines
1.0 KiB
YAML

---
- name: Ensure remote tmp directory exists
file:
path: /tmp/ansible-{{ ansible_user }}
state: directory
mode: '0755'
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
- name: Sync setup_k3s.sh to remote
synchronize:
src: files/setup_k3s.sh
dest: /tmp/ansible-{{ ansible_user }}/setup_k3s.sh
mode: push
delegate_to: localhost
become: false
- name: Sync set-registry.sh to remote
synchronize:
src: files/set-registry.sh
dest: /tmp/ansible-{{ ansible_user }}/set-registry.sh
mode: push
delegate_to: localhost
become: false
- name: Ensure setup_k3s.sh is executable
file:
path: /tmp/ansible-{{ ansible_user }}/setup_k3s.sh
mode: '0755'
- name: Ensure set-registry.sh is executable
file:
path: /tmp/ansible-{{ ansible_user }}/set-registry.sh
mode: '0755'
- name: Run setup_k3s.sh
command: ./setup_k3s.sh
args:
chdir: /tmp/ansible-{{ ansible_user }}
- name: Run set-registry.sh
command: ./set-registry.sh
args:
chdir: /tmp/ansible-{{ ansible_user }}