-
Notifications
You must be signed in to change notification settings - Fork 3
/
configue-ubuntu-infra.yml
executable file
·48 lines (48 loc) · 1.63 KB
/
configue-ubuntu-infra.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
---
- name: Configure all nodes
hosts: master worker
gather_facts: False
become: true
tasks:
- name: Run the equivalent of "apt-get update" as a separate step
apt:
update_cache: yes
- name: Install docker
apt: name=docker.io state=latest
- name: Start docker service
service: name=docker state=started
- name: Enable service docker , and not touch the state
service: name=docker enabled=yes
- name: Install apt-transport-https
apt: name=apt-transport-https state=latest
- name: Configure K8 Repo
shell:
cmd: curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- name: perform package update
shell:
cmd: echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list && sudo apt-get update
- name: Install kubelet
apt: name=kubelet state=latest
- name: Install kubeadm
apt: name=kubeadm state=latest
- name: Install kubectl
apt: name=kubectl state=latest
- name: Install kubernetes-cni
apt: name=kubernetes-cni state=latest
- name: Start kubelet service
service: name=kubelet state=started
- name: Enable service kubelet, and not touch the state
service: name=kubelet enabled=yes
- name: Set Hostname on Nodes
shell:
cmd: sudo hostnamectl set-hostname "{{ group_name}}"-{{ item }}
with_items:
- 1
- 2
- name: Update hosts file
copy:
src: files/hosts
dest: /etc/hosts
# - name: Disable SWAP
# shell:
# cmd: sudo swapoff -v /swapfile