From 4de5a070e1536caf3a642474236c1eaad5653fb5 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Thu, 7 Jan 2021 11:36:03 -0500 Subject: [PATCH] containerd: use package instead of action Signed-off-by: Etienne Champetier (cherry picked from commit 1b88678cf3ca52fad3b2e02e8fc7410090167c93) --- .../container-engine/containerd/tasks/main.yml | 18 +++++++++++------- .../containerd/vars/debian.yml | 4 +--- .../containerd/vars/fedora.yml | 5 ++--- .../containerd/vars/redhat.yml | 5 ++--- .../container-engine/containerd/vars/suse.yml | 4 +--- .../containerd/vars/ubuntu.yml | 4 +--- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/roles/container-engine/containerd/tasks/main.yml b/roles/container-engine/containerd/tasks/main.yml index 7b6fb0d8e..98b110ef7 100644 --- a/roles/container-engine/containerd/tasks/main.yml +++ b/roles/container-engine/containerd/tasks/main.yml @@ -92,18 +92,22 @@ when: ansible_pkg_mgr == 'apt' - name: ensure containerd packages are installed - action: "{{ containerd_package_info.pkg_mgr }}" - args: - pkg: "{{ item.name }}" - force: "{{ item.force | default(omit) }}" + package: + name: "{{ containerd_package_info.pkgs }}" state: present - update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}" - enablerepo: "{{ item.repo | default(omit) }}" + module_defaults: + apt: + update_cache: true + dnf: + enablerepo: "{{ containerd_package_info.enablerepo | default(omit) }}" + yum: + enablerepo: "{{ containerd_package_info.enablerepo | default(omit) }}" + zypper: + update_cache: true register: containerd_task_result until: containerd_task_result is succeeded retries: 4 delay: "{{ retry_stagger | d(3) }}" - with_items: "{{ containerd_package_info.pkgs }}" notify: restart containerd when: - not is_ostree diff --git a/roles/container-engine/containerd/vars/debian.yml b/roles/container-engine/containerd/vars/debian.yml index a1a9adab4..03ece0d69 100644 --- a/roles/container-engine/containerd/vars/debian.yml +++ b/roles/container-engine/containerd/vars/debian.yml @@ -1,9 +1,7 @@ --- containerd_package_info: - pkg_mgr: apt pkgs: - - name: "{{ containerd_versioned_pkg[containerd_version | string] }}" - force: false + - "{{ containerd_versioned_pkg[containerd_version | string] }}" containerd_repo_key_info: pkg_key: apt_key diff --git a/roles/container-engine/containerd/vars/fedora.yml b/roles/container-engine/containerd/vars/fedora.yml index fded2112d..e51f2c89c 100644 --- a/roles/container-engine/containerd/vars/fedora.yml +++ b/roles/container-engine/containerd/vars/fedora.yml @@ -1,6 +1,5 @@ --- containerd_package_info: - pkg_mgr: dnf + enablerepo: "docker-ce" pkgs: - - name: "{{ containerd_versioned_pkg[containerd_version | string] }}" - repo: "docker-ce" + - "{{ containerd_versioned_pkg[containerd_version | string] }}" diff --git a/roles/container-engine/containerd/vars/redhat.yml b/roles/container-engine/containerd/vars/redhat.yml index c2cc3c267..2ea9242db 100644 --- a/roles/container-engine/containerd/vars/redhat.yml +++ b/roles/container-engine/containerd/vars/redhat.yml @@ -1,9 +1,8 @@ --- containerd_package_info: - pkg_mgr: yum + enablerepo: "docker-ce" pkgs: - - name: "{{ containerd_versioned_pkg[containerd_version | string] }}" - repo: "docker-ce" + - "{{ containerd_versioned_pkg[containerd_version | string] }}" containerd_repo_key_info: pkg_key: '' diff --git a/roles/container-engine/containerd/vars/suse.yml b/roles/container-engine/containerd/vars/suse.yml index a2639193c..1931351d1 100644 --- a/roles/container-engine/containerd/vars/suse.yml +++ b/roles/container-engine/containerd/vars/suse.yml @@ -3,10 +3,8 @@ containerd_package: containerd containerd_package_info: - pkg_mgr: zypper pkgs: - - name: "{{ containerd_package }}" - state: latest + - "{{ containerd_package }}" containerd_repo_key_info: pkg_key: '' diff --git a/roles/container-engine/containerd/vars/ubuntu.yml b/roles/container-engine/containerd/vars/ubuntu.yml index 0d247f841..cc3341fe6 100644 --- a/roles/container-engine/containerd/vars/ubuntu.yml +++ b/roles/container-engine/containerd/vars/ubuntu.yml @@ -1,9 +1,7 @@ --- containerd_package_info: - pkg_mgr: apt pkgs: - - name: "{{ containerd_versioned_pkg[containerd_version | string] }}" - force: false + - "{{ containerd_versioned_pkg[containerd_version | string] }}" containerd_repo_key_info: pkg_key: apt_key