-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
66 lines (57 loc) · 1.8 KB
/
main.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
# CentOS specific configuration based on the document:
# https://kubernetes.io/docs/setup/independent/install-kubeadm/
# disable swap - required as of 1.8
# it's mentioned at "Before you begin" section
# but no command line examples.
# kubelet service would fail to start without this.
# see also:
# https://qiita.com/tkusumi/items/0962220a0700cb1f6eb3
# https://qiita.com/sheepland/items/d63bfe24c8e363132f7a
- name: disable swap (runtime)
command: swapoff -a
- name: disable swap (permanent)
lineinfile:
dest: /etc/fstab
backrefs: yes
regexp: '^([^\s]+\s+swap\s+.*)'
line: '# \1'
state: present
# disable firewalld for now to allow all requires ports
# see "Check required ports" section for details
- name: stop and disable firewalld
systemd:
name: firewalld
enabled: no
state: stopped
# some workarounds described in the documents for CentOS,RHEL or Fedora
- name: disable SELinux (runtime)
command: setenforce 0
- name: disable SELinux (permanent)
lineinfile:
dest: /etc/selinux/config
regexp: "^SELINUX="
line: "SELINUX=permissive"
state: present
- name: make sure br_netfilter module is loaded
command: modprobe br_netfilter
changed_when: false
- name: workaround of routing issues
template:
src: k8s.conf
dest: /etc/sysctl.d/k8s.conf
register: rc
- name: reload workaround of routing issues
command: sysctl --system
when: rc.changed
# Add proxy configuration to system environment variables
# this is not described in the document
# but proper no_proxy is necessary to work kubeadm behind proxy
- name: add proxy environment variables
lineinfile:
dest="/etc/environment"
regexp="^export {{ item.split('=')[0] }}="
line="export {{ item }}"
state=present
backup=yes
with_items: "{{ USE_PROXY }}"
when: USE_PROXY is defined