blob: a690d28bd36d9bf1375d3512fcd5e67944e7d5a1 (
plain)
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
|
# Copyright (c) Authors of Clover
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
- name: Checking dependencies for Docker
shell: docker --version
register: doc_ver
ignore_errors: true
failed_when: false
- name: Removing unsupported version of Docker (if any)
apt:
name: "{{ item }}"
state: absent
with_items:
- 'docker'
- 'docker-engine'
- 'docker-ce'
- 'docker.io'
when: doc_ver.stdout.find('18.04.0-ce') == -1
- name: Adding GPG key for Docker
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
when: doc_ver.stdout.find('18.04.0-ce') == -1
- name: Updating sources.list.d directory
shell: echo "deb [arch=armhf] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) edge" | \ tee /etc/apt/sources.list.d/docker.list
when: doc_ver.stdout.find('18.04.0-ce') == -1
- name: Installing Docker 18.04.0
apt:
name: docker-ce=18.04.0~ce~3-0~raspbian
update_cache: yes
when: doc_ver.stdout.find('18.04.0-ce') == -1
- name: Adding user 'pi' to the 'docker' group
shell: usermod pi -aG docker
when: doc_ver.stdout.find('18.04.0-ce') == -1
- name: Removing docker from apt sources to prevent upgrade
file:
path: /etc/apt/sources.list.d/docker.list
state: absent
- name: Turning off swap
shell: dphys-swapfile swapoff && dphys-swapfile uninstall && update-rc.d dphys-swapfile remove
- name: Checking cgroup dependencies
shell: cat /boot/cmdline.txt
register: boot
- name: Enabling cpuset cgroup
shell: sed -i 's/$/ cgroup_enable=cpuset/' /boot/cmdline.txt
args:
warn: false
when: boot.stdout.find('cgroup_enable=cpuset') == -1
- name: Enabling memory cgroup (1/2)
shell: sed -i 's/$/ cgroup_memory=1/' /boot/cmdline.txt
args:
warn: false
when: boot.stdout.find('cgroup_memory=1') == -1
- name: Enabling memory cgroup (2/2)
shell: sed -i 's/$/ cgroup_enable=memory/' /boot/cmdline.txt
args:
warn: false
when: boot.stdout.find('cgroup_enable=memory') == -1
- name: Rebooting
shell: sleep 2 && reboot
async: 1
poll: 0
ignore_errors: true
when: boot.stdout.find('cgroup_enable=cpuset') == -1 or boot.stdout.find('cgroup_memory=1') == -1 or boot.stdout.find('cgroup_enable=memory') == -1
- name: Waiting for host(s) to come online
wait_for_connection:
delay: 30
when: boot.stdout.find('cgroup_enable=cpuset') == -1 or boot.stdout.find('cgroup_memory=1') == -1 or boot.stdout.find('cgroup_enable=memory') == -1
- name: Checking dependencies for Kubernetes
shell: kubeadm version
register: kube_ver
ignore_errors: true
failed_when: false
- name: Removing unsupported version of Kubernetes (if any)
apt:
name: "{{ item }}"
state: absent
autoremove: yes
with_items:
- 'kubeadm'
- 'kubectl'
- 'kubelet'
when: kube_ver.stdout.find('v1.10.2') == -1
- name: Adding GPG key for kubernetes
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
when: kube_ver.stdout.find('v1.10.2') == -1
- name: Updating sources.list.d directory
shell: echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
when: kube_ver.stdout.find('v1.10.2') == -1
- name: Installing kubeadm, kubectl and kubelet version 1.10.2-00
apt:
name: "{{ item }}"
update_cache: true
with_items:
- 'kubeadm=1.10.2-00'
- 'kubectl=1.10.2-00'
- 'kubelet=1.10.2-00'
when: kube_ver.stdout.find('v1.10.2') == -1
- name: Removing kubernetes from apt sources to prevent upgrade
file:
path: /etc/apt/sources.list.d/kubernetes.list
state: absent
|