containerd,docker: use apt_key instead of action

we don't need rpm_key, 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 <champetier.etienne@gmail.com>
(cherry picked from commit a2429ef64d)
This commit is contained in:
Etienne Champetier 2021-01-08 16:24:55 -05:00 committed by Kubernetes Prow Robot
parent 4de5a070e1
commit 5e06ee6ea6
10 changed files with 4 additions and 27 deletions

View file

@ -1,7 +1,6 @@
--- ---
- name: ensure containerd repository public key is installed - name: ensure containerd repository public key is installed
action: "{{ containerd_repo_key_info.pkg_key }}" apt_key:
args:
id: "{{ item }}" id: "{{ item }}"
url: "{{ containerd_repo_key_info.url }}" url: "{{ containerd_repo_key_info.url }}"
state: present state: present
@ -11,8 +10,7 @@
delay: "{{ retry_stagger | d(3) }}" delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ containerd_repo_key_info.repo_keys }}" with_items: "{{ containerd_repo_key_info.repo_keys }}"
environment: "{{ proxy_env }}" environment: "{{ proxy_env }}"
when: when: ansible_pkg_mgr == 'apt'
- ansible_os_family in ['Ubuntu', 'Debian']
- name: ensure containerd repository is enabled - name: ensure containerd repository is enabled
action: "{{ containerd_repo_info.pkg_repo }}" action: "{{ containerd_repo_info.pkg_repo }}"

View file

@ -4,7 +4,6 @@ containerd_package_info:
- "{{ containerd_versioned_pkg[containerd_version | string] }}" - "{{ containerd_versioned_pkg[containerd_version | string] }}"
containerd_repo_key_info: containerd_repo_key_info:
pkg_key: apt_key
url: '{{ containerd_debian_repo_gpgkey }}' url: '{{ containerd_debian_repo_gpgkey }}'
repo_keys: repo_keys:
- '{{ containerd_debian_repo_repokey }}' - '{{ containerd_debian_repo_repokey }}'

View file

@ -4,10 +4,6 @@ containerd_package_info:
pkgs: pkgs:
- "{{ containerd_versioned_pkg[containerd_version | string] }}" - "{{ containerd_versioned_pkg[containerd_version | string] }}"
containerd_repo_key_info:
pkg_key: ''
repo_keys: []
containerd_repo_info: containerd_repo_info:
pkg_repo: '' pkg_repo: ''
repos: [] repos: []

View file

@ -6,10 +6,6 @@ containerd_package_info:
pkgs: pkgs:
- "{{ containerd_package }}" - "{{ containerd_package }}"
containerd_repo_key_info:
pkg_key: ''
repo_keys: []
containerd_repo_info: containerd_repo_info:
pkg_repo: '' pkg_repo: ''
repos: [] repos: []

View file

@ -4,7 +4,6 @@ containerd_package_info:
- "{{ containerd_versioned_pkg[containerd_version | string] }}" - "{{ containerd_versioned_pkg[containerd_version | string] }}"
containerd_repo_key_info: containerd_repo_key_info:
pkg_key: apt_key
url: '{{ containerd_ubuntu_repo_gpgkey }}' url: '{{ containerd_ubuntu_repo_gpgkey }}'
repo_keys: repo_keys:
- '{{ containerd_ubuntu_repo_repokey }}' - '{{ containerd_ubuntu_repo_repokey }}'

View file

@ -54,8 +54,7 @@
- import_tasks: pre-upgrade.yml - import_tasks: pre-upgrade.yml
- name: ensure docker-ce repository public key is installed - name: ensure docker-ce repository public key is installed
action: "{{ docker_repo_key_info.pkg_key }}" apt_key:
args:
id: "{{ item }}" id: "{{ item }}"
url: "{{ docker_repo_key_info.url }}" url: "{{ docker_repo_key_info.url }}"
state: present state: present
@ -65,7 +64,7 @@
delay: "{{ retry_stagger | d(3) }}" delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ docker_repo_key_info.repo_keys }}" with_items: "{{ docker_repo_key_info.repo_keys }}"
environment: "{{ proxy_env }}" environment: "{{ proxy_env }}"
when: not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree) when: ansible_pkg_mgr == 'apt'
- name: ensure docker-ce repository is enabled - name: ensure docker-ce repository is enabled
action: "{{ docker_repo_info.pkg_repo }}" action: "{{ docker_repo_info.pkg_repo }}"

View file

@ -21,7 +21,6 @@ docker_package_info:
- "{{ docker_versioned_pkg[docker_version | string] }}" - "{{ docker_versioned_pkg[docker_version | string] }}"
docker_repo_key_info: docker_repo_key_info:
pkg_key: apt_key
url: '{{ docker_debian_repo_gpgkey }}' url: '{{ docker_debian_repo_gpgkey }}'
repo_keys: repo_keys:
- 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 - 9DC858229FC7DD38854AE2D88D81803C0EBFCD88

View file

@ -23,10 +23,6 @@ docker_package_info:
- "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" - "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- "{{ docker_versioned_pkg[docker_version | string] }}" - "{{ docker_versioned_pkg[docker_version | string] }}"
docker_repo_key_info:
pkg_key: ''
repo_keys: []
docker_repo_info: docker_repo_info:
pkg_repo: '' pkg_repo: ''
repos: [] repos: []

View file

@ -5,10 +5,6 @@ docker_package_info:
- docker - docker
- containerd - containerd
docker_repo_key_info:
pkg_key: ''
repo_keys: []
docker_repo_info: docker_repo_info:
pkg_repo: '' pkg_repo: ''
repos: [] repos: []

View file

@ -21,7 +21,6 @@ docker_package_info:
- "{{ docker_versioned_pkg[docker_version | string] }}" - "{{ docker_versioned_pkg[docker_version | string] }}"
docker_repo_key_info: docker_repo_key_info:
pkg_key: apt_key
url: '{{ docker_ubuntu_repo_gpgkey }}' url: '{{ docker_ubuntu_repo_gpgkey }}'
repo_keys: repo_keys:
- 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 - 9DC858229FC7DD38854AE2D88D81803C0EBFCD88