forked from fsadykov/ansible-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dependencies.yml
97 lines (82 loc) · 2.34 KB
/
dependencies.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
92
93
94
95
96
- hosts: all
become: yes
tasks:
- name: Check OS version
fail:
msg: "Playbook works on RedHat/CentOS 7 only!!!"
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int < 7
- name: Disable SELinux
selinux:
policy: targeted
state: permissive
ignore_errors: true
- name: Stop and disable firewalld.
service:
name: firewalld
state: stopped
enabled: False
ignore_errors: true
- name: Disable swap
command: "{{item}}"
with_items:
- cp /etc/fstab /root/fstab
- sed -i /"swap"/d /etc/fstab
- swapoff -a
ignore_errors: true
- name: Upgrade kernel
yum: name=kernel state=latest
- name: Rebooting ...
shell: "sleep 3 && reboot"
async: 1
poll: 0
register: rebooting
ignore_errors: true
- name: Wait for rebooted servers to come back
local_action: wait_for host={{ ansible_ssh_host | default(inventory_hostname) }} state=started port=22 delay=30 timeout=300 connect_timeout=15
when: rebooting|changed
- name: Add Docker repository
get_url:
url: https://download.docker.com/linux/centos/docker-ce.repo
dest: /etc/yum.repos.d/docker-ce.repo
mode: 0644
- name: Install Docker-CE
yum:
name: docker-ce
state: present
update_cache: true
- name: Creating Kubernetes 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: Installing Kubernetes
yum:
name: "{{ packages }}"
state: latest
vars:
packages:
- kubelet
- kubeadm
- kubectl
- name: Start and enable docker.
service:
name: docker
state: started
enabled: True
- name: Start and enable kubelet.
service:
name: kubelet
state: started
enabled: True
- name: sysctl update-1
sysctl:
name: net.bridge.bridge-nf-call-iptables
value: 1
state: present
- name: sysctl update-2
sysctl:
name: net.bridge.bridge-nf-call-ip6tables
value: 1
state: present