-
Notifications
You must be signed in to change notification settings - Fork 39
/
kubernetes_worker_prerequisites.yml
58 lines (58 loc) · 1.39 KB
/
kubernetes_worker_prerequisites.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
---
- name: Generate Hosts File
hosts: worker
become: true
gather_facts: true
tasks:
- name: Upgrade all packages
yum: name=* state=latest
- name: Install Docker
package:
name: docker
state: latest
become: yes
- name: Start Docker service
service:
name: docker
state: started
enabled: yes
become: yes
- name: Disable SELinux
selinux:
state: disabled
- name: Reboot the machine
reboot:
- name: Copy /etc/yum.repos.d/kubernetes.repo
copy:
src: /opt/ansible/files/kubernetes.repo
dest: /etc/yum.repos.d/kubernetes.repo
owner: root
group: root
mode: '0644'
- name: Upgrade all packages
yum: name=* state=latest
- name: Install Kubernetes Package
yum:
name: "{{packages}}"
state: present
vars:
packages:
- kubelet
- kubeadm
- kubectl
- name: Enable / Start kubelet Service
service:
name: kubelet
state: started
enabled: yes
- name: Letting iptables see bridged traffic
copy:
src: /opt/k8s/files/k8s.conf
dest: /etc/sysctl.d/k8s.conf
owner: root
group: root
mode: '0644'
- name: Reload sysctl config for iptables
command: sysctl --system
- name: Disable SWAP
command: swapoff -a