23 lines
632 B
YAML
23 lines
632 B
YAML
---
|
|
- name: See if k3s file exists
|
|
ansible.builtin.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 with longhorn affinity
|
|
when: not k3s_status.stat.exists
|
|
ansible.builtin.command: |
|
|
/tmp/k3s_install.sh \
|
|
--node-label longhorn=true
|
|
environment:
|
|
K3S_URL: "https://{{ k3s.loadbalancer.ip }}:{{ k3s.loadbalancer.default_port }}"
|
|
K3S_TOKEN: "{{ k3s_token }}"
|
|
become: true
|