ansible/roles/k3s_agent/tasks/installation.yml

22 lines
542 B
YAML

---
- name: See if k3s file exists
stat:
path: /usr/local/bin/k3s
register: k3s_status
- name: Download K3s install script to /tmp/
when: not k3s_status.stat.exists
ansible.builtin.get_url:
url: https://get.k3s.io
dest: /tmp/k3s_install.sh
mode: "0755"
- name: Install K3s on the secondary servers
when: not k3s_status.stat.exists
command: |
/tmp/k3s_install.sh
environment:
K3S_URL: "https://{{ k3s.loadbalancer.ip }}:{{k3s.loadbalancer.default_port}}"
K3S_TOKEN: "{{ k3s_token }}"
become: true