-
Notifications
You must be signed in to change notification settings - Fork 107
/
install-packages-Debian.yml
34 lines (30 loc) · 1.07 KB
/
install-packages-Debian.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
---
- name: Get information on installed packages as facts
package_facts:
manager: auto
when: ansible_facts.packages is undefined
- name: Check containerd.io versions
when:
- ansible_facts.packages['containerd.io'] is defined
block:
- name: Set fact installed containerd.io version
set_fact:
containerd_installed: "{{ ansible_facts.packages['containerd.io'][0].version.split('-')[0] }}"
- name: Print containerd.io versions
debug:
msg:
- "Installed version: {{ containerd_installed }}"
- "Target version: {{ containerd_version }}"
# apt module doesn't support --allow-downgrades so we remove packages as workaround
- name: Remove containerd.io package installed as dependency if they exist
apt:
name: containerd.io
state: absent
when:
- containerd_version is version(containerd_installed, '!=')
- name: Install containerd.io package for Debian family
apt:
update_cache: true
name:
- containerd.io={{ containerd_version }}-* # provides "runc"
state: present