-
Notifications
You must be signed in to change notification settings - Fork 5
/
install-ubuntu-packages.yml
65 lines (58 loc) · 1.75 KB
/
install-ubuntu-packages.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
---
#
# Copyright (c) 2021 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
- name: Gather variables
include_vars: "vars/ubuntu.yml"
- name: Install prerequisite packages for adding repos and installing kubelet
apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- name: Check if containerd executable exists
stat:
path: /usr/local/bin/containerd
register: containerd_installed
- name: Get containerd version if exists
command: "/usr/local/bin/containerd --version"
register: containerd_installed_ver
when: containerd_installed.stat.exists
- name: Install containerd
unarchive:
src: "https://storage.googleapis.com/cri-containerd-release/cri-containerd-{{ containerd_version }}.linux-amd64.tar.gz"
dest: /
remote_src: yes
environment:
http_proxy: "{{ http_proxy }}"
https_proxy: "{{ https_proxy }}"
no_proxy: "{{ no_proxy }}"
when: (not containerd_installed.stat.exists or containerd_installed_ver.stdout != containerd_version)
- name: Add kubernetes repo key
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
environment:
http_proxy: "{{ http_proxy }}"
https_proxy: "{{ https_proxy }}"
no_proxy: "{{ no_proxy }}"
- name: Add kubernetes repo to apt repo
apt_repository:
repo: deb https://apt.kubernetes.io/ kubernetes-xenial main
state: present
- name: Ensure k8s packages are installed
action: "{{ k8s_package_info.pkg_mgr }}"
args:
pkg: "{{ item.name }}"
state: present
force: true
update_cache: true
register: install_task_result
until: install_task_result is succeeded
retries: 5
delay: "{{ retry_stagger | d(5) }}"
with_items: "{{ k8s_package_info.pkgs }}"