forked from networknuts/ansible-k8s-setup
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathk8s-pkg.yml
91 lines (76 loc) · 1.92 KB
/
k8s-pkg.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
- hosts: all
become: yes
tasks:
# - name: disable firewall service for labs
#service:
# name: firewalld
# state: stopped
# enabled: false
- name: Disable SWAP
shell: |
swapoff -a
- name: Disable SWAP in fstab
lineinfile:
path: /etc/fstab
regexp: 'swap'
state: absent
- name: install Docker
yum:
name: docker
state: present
update_cache: true
- name: start Docker
service:
name: docker
state: started
enabled: true
# - name: disable SELinux
#command: setenforce 0
#ignore_errors: yes
#- name: disable SELinux on reboot
#selinux:
#state: disabled
- name: ensure net.bridge.bridge-nf-call-ip6tables is set to 1
sysctl:
name: net.bridge.bridge-nf-call-ip6tables
value: 1
state: present
- name: ensure net.bridge.bridge-nf-call-iptables is set to 1
sysctl:
name: net.bridge.bridge-nf-call-iptables
value: 1
state: present
- name: add Kubernetes YUM repository
yum_repository:
name: Kubernetes
description: Kubernetes YUM repository
baseurl: https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
gpgkey: https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
gpgcheck: yes
- name: install kubelet
yum:
name: kubelet-1.14.0
state: present
update_cache: true
- name: install kubeadm
yum:
name: kubeadm-1.14.0
state: present
- name: start kubelet
service:
name: kubelet
enabled: yes
state: started
- hosts: masters
become: yes
tasks:
- name: install kubectl
yum:
name: kubectl-1.14.0
state: present
allow_downgrade: yes
- hosts: all
become: yes
tasks:
- name: reboot ALL machines
reboot: