-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcluster.yml
73 lines (51 loc) · 1.53 KB
/
cluster.yml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
# Based on:
# - https://github.com/k3s-io/k3s-ansible (k3s installation)
# - https://github.com/ecdye/zram-config (limit SD-card wear out)
# - https://github.com/insspb/ansible-role-hostname (rename nodes)
# Needed (in my case): python 2 instead of Python 3 -> bootstrap
# Set in group_vars/all.yml
- import_playbook: roles/bootstrap.yml
# For every element of the cluster
- hosts: cluster
gather_facts: yes
pre_tasks:
- name: Prerequisite packages (iptables, nfs-common)
apt:
pkg:
# Missing from k3s-io/k3s-ansible
- iptables
# As we plan to use a shared FS for volumes
- nfs-common
roles:
# apt-get update && apt-get upgrade
- role: apt-update
# Ensure hostnames are correctly set
- role: ansible-role-hostname
# zram-config to use compressed memory swap + compressed memory logs
- role: zram-config
# From k3s-io/k3s-ansible
- role: prereq
- role: download
- role: raspberrypi
post_tasks:
- name: Cluster shared NFS file system on Gandalf
mount:
src: gandalf:/scratch/cluster
path: /mnt/shared
opts: rw
state: mounted
fstype: nfs
# Uncomment in case of issue; should already have been done in raspberrypi role
# - name: reboot cluster
# reboot:
# Cluster master node specifics
- hosts: master
roles:
- role: k3s/master
# Cluster nodes specifics
- hosts: node
roles:
- role: k3s/node
# Get .kube/config file
# scp pinode0:~/.kube/config ~/.kube/config