Browse Source

docker: use package instead of action, cleanup

Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
pull/7193/head
Etienne Champetier 3 years ago
committed by Kubernetes Prow Robot
parent
commit
0e96852159
8 changed files with 35 additions and 49 deletions
  1. 38
      roles/container-engine/docker/tasks/main.yml
  2. 3
      roles/container-engine/docker/vars/amazon.yml
  3. 3
      roles/container-engine/docker/vars/clearlinux.yml
  4. 7
      roles/container-engine/docker/vars/debian.yml
  5. 8
      roles/container-engine/docker/vars/fedora.yml
  6. 11
      roles/container-engine/docker/vars/redhat.yml
  7. 7
      roles/container-engine/docker/vars/suse.yml
  8. 7
      roles/container-engine/docker/vars/ubuntu.yml

38
roles/container-engine/docker/tasks/main.yml

@ -120,33 +120,27 @@
- docker-ce-cli
- name: ensure docker packages are installed
action: "{{ docker_package_info.pkg_mgr }}"
args:
pkg: "{{ item.name }}"
force: "{{ item.force|default(omit) }}"
state: "{{ item.state | default('present') }}"
update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}"
enablerepo: "{{ item.repo | default(omit) }}"
package:
name: "{{ docker_package_info.pkgs }}"
state: "{{ docker_package_info.state | default('present') }}"
module_defaults:
apt:
update_cache: true
dnf:
enablerepo: "{{ docker_package_info.enablerepo | default(omit) }}"
yum:
enablerepo: "{{ docker_package_info.enablerepo | default(omit) }}"
zypper:
update_cache: true
register: docker_task_result
until: docker_task_result is succeeded
retries: 4
delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ docker_package_info.pkgs }}"
notify: restart docker
when: not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "ClearLinux"] or is_ostree) and (docker_package_info.pkgs|length > 0)
- name: Ensure docker packages are installed
action: "{{ docker_package_info.pkg_mgr }}"
args:
name: "{{ item.name }}"
state: "{{ item.state | default('present') }}"
with_items: "{{ docker_package_info.pkgs }}"
register: docker_task_result
until: docker_task_result is succeeded
retries: 4
delay: "{{ retry_stagger | d(3) }}"
notify: restart docker
when: ansible_os_family in ["ClearLinux"]
when:
- not ansible_os_family in ["Flatcar Container Linux by Kinvolk"]
- not is_ostree
- docker_package_info.pkgs|length > 0
# This is required to ensure any apt upgrade will not break kubernetes
- name: Tell Debian hosts not to change the docker version with apt upgrade

3
roles/container-engine/docker/vars/amazon.yml

@ -9,6 +9,5 @@ docker_versioned_pkg:
docker_version: "latest"
docker_package_info:
pkg_mgr: yum
pkgs:
- name: "{{ docker_versioned_pkg[docker_version | string] }}"
- "{{ docker_versioned_pkg[docker_version | string] }}"

3
roles/container-engine/docker/vars/clearlinux.yml

@ -1,5 +1,4 @@
---
docker_package_info:
pkg_mgr: swupd
pkgs:
- name: "containers-basic"
- "containers-basic"

7
roles/container-engine/docker/vars/debian.yml

@ -15,11 +15,10 @@ docker_cli_versioned_pkg:
'20.10': docker-ce-cli=5:20.10.2~3-0~debian-{{ ansible_distribution_release|lower }}
docker_package_info:
pkg_mgr: apt
pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- name: "{{ docker_versioned_pkg[docker_version | string] }}"
- "{{ containerd_versioned_pkg[containerd_version | string] }}"
- "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- "{{ docker_versioned_pkg[docker_version | string] }}"
docker_repo_key_info:
pkg_key: apt_key

8
roles/container-engine/docker/vars/fedora.yml

@ -14,8 +14,8 @@ docker_cli_versioned_pkg:
'20.10': docker-ce-cli-20.10.2-3.fc{{ ansible_distribution_major_version }}
docker_package_info:
pkg_mgr: dnf
enablerepo: "docker-ce"
pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- name: "{{ docker_versioned_pkg[docker_version | string] }}"
- "{{ containerd_versioned_pkg[containerd_version | string] }}"
- "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- "{{ docker_versioned_pkg[docker_version | string] }}"

11
roles/container-engine/docker/vars/redhat.yml

@ -17,14 +17,11 @@ docker_cli_versioned_pkg:
'20.10': docker-ce-cli-20.10.2-3.el{{ ansible_distribution_major_version }}
docker_package_info:
pkg_mgr: yum
enablerepo: "docker-ce"
pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
repo: "docker-ce"
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
repo: "docker-ce"
- name: "{{ docker_versioned_pkg[docker_version | string] }}"
repo: "docker-ce"
- "{{ containerd_versioned_pkg[containerd_version | string] }}"
- "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- "{{ docker_versioned_pkg[docker_version | string] }}"
docker_repo_key_info:
pkg_key: ''

7
roles/container-engine/docker/vars/suse.yml

@ -1,10 +1,9 @@
---
docker_package_info:
pkg_mgr: zypper
state: latest
pkgs:
- name: docker
- name: containerd
state: latest
- docker
- containerd
docker_repo_key_info:
pkg_key: ''

7
roles/container-engine/docker/vars/ubuntu.yml

@ -15,11 +15,10 @@ docker_cli_versioned_pkg:
'20.10': docker-ce-cli=5:20.10.2~3-0~ubuntu-{{ ansible_distribution_release|lower }}
docker_package_info:
pkg_mgr: apt
pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- name: "{{ docker_versioned_pkg[docker_version | string] }}"
- "{{ containerd_versioned_pkg[containerd_version | string] }}"
- "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- "{{ docker_versioned_pkg[docker_version | string] }}"
docker_repo_key_info:
pkg_key: apt_key

Loading…
Cancel
Save