-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk3s.yaml
32 lines (26 loc) · 876 Bytes
/
k3s.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
- name: K3s master node install
hosts: master
gather_facts: false
become: true
tasks:
- name: Install K3s
ansible.builtin.shell: >-
curl -sfL https://get.k3s.io | sh -
- name: Get node token.
ansible.builtin.command: cat /var/lib/rancher/k3s/server/node-token
changed_when: false
register: node_token_output
- name: Set node_token fact.
ansible.builtin.set_fact:
node_token: "{{ node_token_output.stdout_lines[0] }}"
- name: Configure the worker nodes.
hosts: nodes
gather_facts: false
become: true
tasks:
- name: Install K3s on worker nodes
ansible.builtin.shell: >-
curl -sfL https://get.k3s.io | K3S_URL=https://{{ groups['master'][0] }}:6443 K3S_TOKEN={{ hostvars[groups['master'][0]]['node_token'] }} sh -
- name: Set up Helm.
import_playbook: helm.yaml
tags: ['helm']