-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep-1-install-dependencies.yaml
136 lines (119 loc) · 3.33 KB
/
step-1-install-dependencies.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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
- hosts: all
become: yes
tasks:
- name: Remove swap from /etc/fstab (impacts next reboots)
mount:
name: swap
fstype: swap
state: absent
- name: Disable swap for the current session
command: swapoff -a
when: ansible_swaptotal_mb > 0
- name: Stop enforcing selinux for the current boot
command: setenforce 0
- name: Disable selinux for future boots
selinux:
state: disabled
- name: Disable firewalld
service:
name: firewalld
state: stopped
enabled: no
- name: Install docker dependencies
yum:
name:
- yum-utils
- device-mapper-persistent-data
- lvm2
state: present
- name: Add docker-ce-stable repository
yum_repository:
name: docker
description: docker
baseurl: https://download.docker.com/linux/centos/7/x86_64/stable
gpgkey: https://download.docker.com/linux/centos/gpg
gpgcheck: yes
exclude: docker*
- name: Install docker
yum:
name: docker-ce-18.09.9
state: present
update_cache: true
allow_downgrade: yes
disable_excludes: docker
- name: Create /etc/docker if it does not exist
file:
path: /etc/docker
state: directory
mode: '0755'
- name: Add docker daemon configuration
copy:
src: docker-daemon.json
dest: /etc/docker/daemon.json
- name: Start docker
service:
name: docker
state: started
enabled: yes
- name: Set net.bridge.bridge-nf-call-iptables to 1
sysctl:
name: net.bridge.bridge-nf-call-iptables
value: 1
state: present
sysctl_set: yes
- name: Disable ipv6 for all
sysctl:
name: net.ipv6.conf.all.disable_ipv6
value: 1
state: present
sysctl_set: yes
- name: Disable ipv6 for default
sysctl:
name: net.ipv6.conf.default.disable_ipv6
value: 1
state: present
sysctl_set: yes
- name: Add Kubernetes repository
yum_repository:
name: kubernetes
description: kubernetes
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
exclude: kube*
- name: Install kubelet
yum:
name: kubelet-1.16.1
state: present
disable_excludes: kubernetes
update_cache: true
- name: Install kubeadm
yum:
name: kubeadm-1.16.1
state: present
disable_excludes: kubernetes
- name: Start kubelet
service:
name: kubelet
enabled: yes
state: started
- name: Create centos user
user:
name: centos
password: "$6$QUgphi6lokEKeGo6$JXskjWkxKfk2LhjBpBOCviXuSK6C3dGsvr7BhCOqc4Buv1VBlni9DOu1Iz4AyHwRGan.rqZKnkIDJwG08B35p0"
groups:
- docker
state: present
shell: /bin/bash
system: no
createhome: yes
home: /home/centos
- hosts: master
become: yes
tasks:
- name: Install kubectl
yum:
name: kubectl-1.16.1
state: present
allow_downgrade: yes
disable_excludes: kubernetes