From d22634a597b2f4ac69fa0da13bac4b935d95e37d Mon Sep 17 00:00:00 2001 From: Johannes Scheuermann Date: Mon, 5 Aug 2019 16:29:48 +0200 Subject: [PATCH] Refactor containerd ubuntu setup and remove redundant tasks (#5015) --- .../containerd/defaults/main.yml | 2 +- .../containerd/tasks/containerd_repo.yml | 21 ---------- .../containerd/tasks/crictl.yml | 3 +- .../containerd/tasks/main.yml | 39 +------------------ .../containerd/vars/ubuntu-amd64.yml | 3 +- 5 files changed, 6 insertions(+), 62 deletions(-) diff --git a/roles/container-engine/containerd/defaults/main.yml b/roles/container-engine/containerd/defaults/main.yml index 0db20cb3c..e876a2c61 100644 --- a/roles/container-engine/containerd/defaults/main.yml +++ b/roles/container-engine/containerd/defaults/main.yml @@ -16,7 +16,7 @@ containerd_package: 'containerd.io' containerd_cfg_dir: /etc/containerd -# Path to runc binray +# Path to runc binary runc_binary: /usr/sbin/runc diff --git a/roles/container-engine/containerd/tasks/containerd_repo.yml b/roles/container-engine/containerd/tasks/containerd_repo.yml index 8294f0e0e..e2e8afa07 100644 --- a/roles/container-engine/containerd/tasks/containerd_repo.yml +++ b/roles/container-engine/containerd/tasks/containerd_repo.yml @@ -36,27 +36,6 @@ - ansible_os_family in ['Ubuntu', 'Debian'] - not is_atomic -- name: ensure containerd repository public key is installed - action: "{{ containerd_repo_key_info.pkg_key }}" - args: - id: "{{ item }}" - url: "{{ containerd_repo_key_info.url }}" - state: present - register: keyserver_task_result - until: keyserver_task_result is succeeded - retries: 4 - delay: "{{ retry_stagger | d(3) }}" - with_items: "{{ containerd_repo_key_info.repo_keys }}" - when: not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "RedHat", "Suse", "ClearLinux"] or is_atomic) - -- name: ensure containerd repository is enabled - action: "{{ containerd_repo_info.pkg_repo }}" - args: - repo: "{{ item }}" - state: present - with_items: "{{ containerd_repo_info.repos }}" - when: not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "RedHat", "Suse", "ClearLinux"] or is_atomic) and (containerd_repo_info.repos|length > 0) - - name: Configure containerd repository on Fedora template: src: "fedora_containerd.repo.j2" diff --git a/roles/container-engine/containerd/tasks/crictl.yml b/roles/container-engine/containerd/tasks/crictl.yml index 05f37205c..60a9c91aa 100644 --- a/roles/container-engine/containerd/tasks/crictl.yml +++ b/roles/container-engine/containerd/tasks/crictl.yml @@ -22,5 +22,6 @@ delegate_to: "{{ inventory_hostname }}" - name: Install crictl completion - shell: /usr/local/bin/crictl completion >/etc/bash_completion.d/crictl + shell: "{{ bin_dir }}/crictl completion >/etc/bash_completion.d/crictl" ignore_errors: True + when: ansible_distribution in ["CentOS","RedHat", "Ubuntu", "Debian"] diff --git a/roles/container-engine/containerd/tasks/main.yml b/roles/container-engine/containerd/tasks/main.yml index a649daae1..2d4d6d489 100644 --- a/roles/container-engine/containerd/tasks/main.yml +++ b/roles/container-engine/containerd/tasks/main.yml @@ -42,33 +42,6 @@ mode: 0644 notify: restart containerd - -- name: ensure containerd repository public key is installed - action: "{{ containerd_repo_key_info.pkg_key }}" - args: - id: "{{ item }}" - url: "{{ containerd_repo_key_info.url }}" - state: present - register: keyserver_task_result - until: keyserver_task_result is succeeded - retries: 4 - delay: "{{ retry_stagger | d(3) }}" - with_items: "{{ containerd_repo_key_info.repo_keys }}" - when: - - ansible_os_family in ['Ubuntu', 'Debian'] - - not is_atomic - -- name: ensure containerd repository is enabled - action: "{{ containerd_repo_info.pkg_repo }}" - args: - repo: "{{ item }}" - state: present - with_items: "{{ containerd_repo_info.repos }}" - when: - - ansible_os_family in ['Ubuntu', 'Debian'] - - not is_atomic - - containerd_repo_info.repos|length > 0 - # This is required to ensure any apt upgrade will not break kubernetes - name: Set containerd pin priority to apt_preferences on Debian family template: @@ -119,14 +92,4 @@ - not is_atomic - not runc_stat.stat.exists -- name: Install crictl config - template: - src: crictl.yaml.j2 - dest: /etc/crictl.yaml - owner: bin - mode: 0644 - -- name: Install crictl completion - shell: "{{ bin_dir }}/crictl completion >/etc/bash_completion.d/crictl" - ignore_errors: True - when: ansible_distribution in ["CentOS","RedHat", "Ubuntu", "Debian"] +- include_tasks: crictl.yml diff --git a/roles/container-engine/containerd/vars/ubuntu-amd64.yml b/roles/container-engine/containerd/vars/ubuntu-amd64.yml index 3b49c2f67..695e20b6a 100644 --- a/roles/container-engine/containerd/vars/ubuntu-amd64.yml +++ b/roles/container-engine/containerd/vars/ubuntu-amd64.yml @@ -3,6 +3,7 @@ containerd_versioned_pkg: 'latest': "{{ containerd_package }}" '1.2.4': "{{ containerd_package }}=1.2.4-1" + '1.2.5': "{{ containerd_package }}=1.2.5-1" '1.2.6': "{{ containerd_package }}=1.2.6-3" 'stable': "{{ containerd_package }}=1.2.4-1" 'edge': "{{ containerd_package }}=1.2.4-1" @@ -11,7 +12,7 @@ containerd_package_info: pkg_mgr: apt pkgs: - name: "{{ containerd_versioned_pkg[containerd_version | string] }}" - force: true + force: false containerd_repo_key_info: pkg_key: apt_key