Refactor containerd ubuntu setup and remove redundant tasks (#5015)
This commit is contained in:
parent
4132cee687
commit
d22634a597
5 changed files with 6 additions and 62 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue