ansible/playbooks/72_install_k3s_worker.yml

27 lines
1003 B
YAML
Raw Normal View History

2022-12-14 02:23:34 +01:00
- hosts: odroid_worker
2023-10-24 16:56:31 +02:00
name: Setup k3s workers
2022-12-14 02:23:34 +01:00
become: true
2023-10-23 10:52:53 +02:00
vars:
K3S_TOKEN_HOLDER: "{{ hostvars['K3S_TOKEN_HOLDER']['token'] }}"
# K3S_TOKEN_HOLDER: "K10e86c2dee93cc36d405fbeb34ef64e8867c097493ef2e0f2e95feb5bb30ded39b::server:5f3d5033ee0554caab810c863b0587d2"
2022-12-14 02:23:34 +01:00
tasks:
- name: Print token
ansible.builtin.debug:
2023-10-23 10:52:53 +02:00
msg: "[Master] K3S_TOKEN_HOLDER K8S token is {{ K3S_TOKEN_HOLDER }}"
2022-12-14 02:23:34 +01:00
- name: Print msg
ansible.builtin.debug:
2023-10-23 10:52:53 +02:00
msg: "{{ K3S_TOKEN_HOLDER }}"
2022-12-14 02:23:34 +01:00
- name: Get hostname
ansible.builtin.command: uname -n
register: result
changed_when: false
- name: Print hostname
ansible.builtin.debug:
msg: "{{ result.stdout }}"
- name: Install K3S Worker
ansible.builtin.shell: >-
curl -sfL https://get.k3s.io
2023-10-23 10:52:53 +02:00
| K3S_TOKEN={{ K3S_TOKEN_HOLDER }}
K3S_URL="https://192.168.77.131:6443" K3S_NODE_NAME="{{ result.stdout }}" INSTALL_K3S_VERSION="v1.24.1+k3s1" sh -
2022-12-14 02:23:34 +01:00
changed_when: false