2024-09-20 16:57:59 +02:00
|
|
|
---
|
|
|
|
- name: See if k3s file exists
|
2024-10-08 11:31:26 +02:00
|
|
|
ansible.builtin.stat:
|
2024-09-20 16:57:59 +02:00
|
|
|
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
|
2024-10-08 11:31:26 +02:00
|
|
|
ansible.builtin.command: |
|
2024-09-20 16:57:59 +02:00
|
|
|
/tmp/k3s_install.sh
|
|
|
|
environment:
|
2024-10-08 11:31:26 +02:00
|
|
|
K3S_URL: "https://{{ k3s.loadbalancer.ip }}:{{ k3s.loadbalancer.default_port }}"
|
2024-09-20 16:57:59 +02:00
|
|
|
K3S_TOKEN: "{{ k3s_token }}"
|
|
|
|
become: true
|