87 lines
1.8 KiB
YAML
87 lines
1.8 KiB
YAML
- hosts: all
|
|
become: yes
|
|
tasks:
|
|
- name: remove swap from /etc/fstab
|
|
mount:
|
|
name: swap
|
|
fstype: swap
|
|
state: absent
|
|
|
|
- name: disable swap
|
|
command: swapoff -a
|
|
when: ansible_swaptotal_mb > 0
|
|
|
|
- name: install Docker
|
|
yum:
|
|
name: docker
|
|
state: present
|
|
update_cache: true
|
|
|
|
- name: start Docker
|
|
service:
|
|
name: docker
|
|
state: started
|
|
|
|
- name: enable Docker
|
|
service:
|
|
name: docker
|
|
state: started
|
|
enabled: yes
|
|
|
|
- name: disable firewalld
|
|
service:
|
|
name: firewalld
|
|
enabled: no
|
|
|
|
- name: disable SELinux
|
|
command: setenforce 0
|
|
|
|
- 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
|
|
state: present
|
|
update_cache: true
|
|
|
|
- name: install kubeadm
|
|
yum:
|
|
name: kubeadm
|
|
state: present
|
|
|
|
- name: start kubelet
|
|
service:
|
|
name: kubelet
|
|
enabled: yes
|
|
state: started
|
|
|
|
- hosts: master
|
|
become: yes
|
|
tasks:
|
|
- name: install kubectl
|
|
yum:
|
|
name: kubectl
|
|
state: present
|