-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstkuber-node.yml
50 lines (43 loc) · 1.21 KB
/
instkuber-node.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
---
- hosts: all
become: true
tasks:
- name: Remove swapfile from /etc/fstab
mount:
name: "{{ item }}"
fstype: swap
state: absent
with_items:
- swap
- none
- name: Disable swap
command: swapoff -a
when: ansible_swaptotal_mb > 0
- name: Add an apt signing key for Kubernetes
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
- name: Adding apt repository for Kubernetes
apt_repository:
repo: deb https://apt.kubernetes.io/ kubernetes-xenial main
state: present
filename: kubernetes.list
- name: Install Kubernetes binaries
apt:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- kubelet=1.18.3-00
- kubeadm=1.18.3-00
- kubectl=1.18.3-00
- name: Restart kubelet
systemd:
daemon_reload: yes
name: kubelet
state: restarted
- name: Copy the join command to node
copy: src=join-command dest=/tmp/join-command.sh mode=0755
- name: Join the node to cluster
command: sh /tmp/join-command.sh