From a8e51e686e6fe548614013dc0075512a83761c45 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Fri, 8 Jan 2021 16:51:06 -0500 Subject: [PATCH] containerd,docker: use apt_repository instead of action yum_repository expect really different params, so nothing to factor here Ubuntu is not an ansible_os_family, the OS family for Ubuntu is Debian Check for ansible_pkg_mgr == apt Signed-off-by: Etienne Champetier --- .../container-engine/containerd/tasks/containerd_repo.yml | 7 ++----- roles/container-engine/containerd/vars/debian.yml | 1 - roles/container-engine/containerd/vars/redhat.yml | 4 ---- roles/container-engine/containerd/vars/suse.yml | 4 ---- roles/container-engine/containerd/vars/ubuntu.yml | 1 - roles/container-engine/docker/tasks/main.yml | 5 ++--- roles/container-engine/docker/vars/debian.yml | 1 - roles/container-engine/docker/vars/redhat.yml | 4 ---- roles/container-engine/docker/vars/suse.yml | 4 ---- roles/container-engine/docker/vars/ubuntu.yml | 1 - 10 files changed, 4 insertions(+), 28 deletions(-) diff --git a/roles/container-engine/containerd/tasks/containerd_repo.yml b/roles/container-engine/containerd/tasks/containerd_repo.yml index 81971e7f3..64c360d1b 100644 --- a/roles/container-engine/containerd/tasks/containerd_repo.yml +++ b/roles/container-engine/containerd/tasks/containerd_repo.yml @@ -13,14 +13,11 @@ when: ansible_pkg_mgr == 'apt' - name: ensure containerd repository is enabled - action: "{{ containerd_repo_info.pkg_repo }}" - args: + apt_repository: repo: "{{ item }}" state: present with_items: "{{ containerd_repo_info.repos }}" - when: - - ansible_os_family in ['Ubuntu', 'Debian'] - - containerd_repo_info.repos|length > 0 + when: ansible_pkg_mgr == 'apt' - name: Configure containerd repository on Fedora template: diff --git a/roles/container-engine/containerd/vars/debian.yml b/roles/container-engine/containerd/vars/debian.yml index 270a5e11f..7b73083da 100644 --- a/roles/container-engine/containerd/vars/debian.yml +++ b/roles/container-engine/containerd/vars/debian.yml @@ -9,7 +9,6 @@ containerd_repo_key_info: - '{{ containerd_debian_repo_repokey }}' containerd_repo_info: - pkg_repo: apt_repository repos: - > deb {{ containerd_debian_repo_base_url }} diff --git a/roles/container-engine/containerd/vars/redhat.yml b/roles/container-engine/containerd/vars/redhat.yml index 25cb72470..e51f2c89c 100644 --- a/roles/container-engine/containerd/vars/redhat.yml +++ b/roles/container-engine/containerd/vars/redhat.yml @@ -3,7 +3,3 @@ containerd_package_info: enablerepo: "docker-ce" pkgs: - "{{ containerd_versioned_pkg[containerd_version | string] }}" - -containerd_repo_info: - pkg_repo: '' - repos: [] diff --git a/roles/container-engine/containerd/vars/suse.yml b/roles/container-engine/containerd/vars/suse.yml index e32c249ab..fb45f9ca8 100644 --- a/roles/container-engine/containerd/vars/suse.yml +++ b/roles/container-engine/containerd/vars/suse.yml @@ -5,7 +5,3 @@ containerd_package: containerd containerd_package_info: pkgs: - "{{ containerd_package }}" - -containerd_repo_info: - pkg_repo: '' - repos: [] diff --git a/roles/container-engine/containerd/vars/ubuntu.yml b/roles/container-engine/containerd/vars/ubuntu.yml index 94fa56a2d..a43797e65 100644 --- a/roles/container-engine/containerd/vars/ubuntu.yml +++ b/roles/container-engine/containerd/vars/ubuntu.yml @@ -9,7 +9,6 @@ containerd_repo_key_info: - '{{ containerd_ubuntu_repo_repokey }}' containerd_repo_info: - pkg_repo: apt_repository repos: - > deb {{ containerd_ubuntu_repo_base_url }} diff --git a/roles/container-engine/docker/tasks/main.yml b/roles/container-engine/docker/tasks/main.yml index 325b70f02..ce7b39480 100644 --- a/roles/container-engine/docker/tasks/main.yml +++ b/roles/container-engine/docker/tasks/main.yml @@ -67,12 +67,11 @@ when: ansible_pkg_mgr == 'apt' - name: ensure docker-ce repository is enabled - action: "{{ docker_repo_info.pkg_repo }}" - args: + apt_repository: repo: "{{ item }}" state: present with_items: "{{ docker_repo_info.repos }}" - when: not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree) and (docker_repo_info.repos|length > 0) + when: ansible_pkg_mgr == 'apt' - name: Configure docker repository on Fedora template: diff --git a/roles/container-engine/docker/vars/debian.yml b/roles/container-engine/docker/vars/debian.yml index 097f3c753..ad7abb5e2 100644 --- a/roles/container-engine/docker/vars/debian.yml +++ b/roles/container-engine/docker/vars/debian.yml @@ -26,7 +26,6 @@ docker_repo_key_info: - 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 docker_repo_info: - pkg_repo: apt_repository repos: - > deb {{ docker_debian_repo_base_url }} diff --git a/roles/container-engine/docker/vars/redhat.yml b/roles/container-engine/docker/vars/redhat.yml index 25c790b57..6551b71a8 100644 --- a/roles/container-engine/docker/vars/redhat.yml +++ b/roles/container-engine/docker/vars/redhat.yml @@ -22,7 +22,3 @@ docker_package_info: - "{{ containerd_versioned_pkg[containerd_version | string] }}" - "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" - "{{ docker_versioned_pkg[docker_version | string] }}" - -docker_repo_info: - pkg_repo: '' - repos: [] diff --git a/roles/container-engine/docker/vars/suse.yml b/roles/container-engine/docker/vars/suse.yml index fb7b91ffe..2d9fbf021 100644 --- a/roles/container-engine/docker/vars/suse.yml +++ b/roles/container-engine/docker/vars/suse.yml @@ -4,7 +4,3 @@ docker_package_info: pkgs: - docker - containerd - -docker_repo_info: - pkg_repo: '' - repos: [] diff --git a/roles/container-engine/docker/vars/ubuntu.yml b/roles/container-engine/docker/vars/ubuntu.yml index 128510b12..21ccc0665 100644 --- a/roles/container-engine/docker/vars/ubuntu.yml +++ b/roles/container-engine/docker/vars/ubuntu.yml @@ -26,7 +26,6 @@ docker_repo_key_info: - 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 docker_repo_info: - pkg_repo: apt_repository repos: - > deb [arch={{ host_architecture }}] {{ docker_ubuntu_repo_base_url }}