aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/k8s/tasks/install_k3s_worker.yml
blob: ffe2af08ae13f64ba4ef44e3acbc699112ecf3fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---
- name: Retrieve k3s token and master IP from master node
  ansible.builtin.set_fact:
    k3s_token: "{{ hostvars[groups['tag_k3s_master'][0]].k3s_token }}"
    k3s_master_ip: "{{ hostvars[groups['tag_k3s_master'][0]].ansible_default_ipv4.address }}"

- name: Download k3s installation script
  ansible.builtin.get_url:
    url: https://get.k3s.io
    dest: /tmp/install_k3s.sh
    mode: '0755'

- name: Install k3s agent
  ansible.builtin.command: >
    /tmp/install_k3s.sh agent
    --server https://{{ k3s_master_ip }}:6443
    --token {{ k3s_token }}
  become: true
...