Manage containerd.io package with docker CRI. (#6218)

* Manage containerd.io package with docker CRI.

* Refactor common containerd stuff to separate role

* Fix check mode and unnecessary shell.
pull/6122/head
Lovro Seder 2020-06-05 14:55:44 +02:00 committed by GitHub
parent 764a851189
commit 5dd85197af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 90 additions and 50 deletions

View File

@ -0,0 +1,3 @@
---
containerd_version: '1.2.13'
containerd_package: 'containerd.io'

View File

@ -0,0 +1,19 @@
---
- name: gather os specific variables
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml"
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_release|lower }}-{{ host_architecture }}.yml"
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_release|lower }}.yml"
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml"
- "{{ ansible_distribution|lower }}-{{ host_architecture }}.yml"
- "{{ ansible_distribution|lower }}.yml"
- "{{ ansible_os_family|lower }}-{{ host_architecture }}.yml"
- "{{ ansible_os_family|lower }}.yml"
- defaults.yml
paths:
- ../vars
skip: true
tags:
- facts

View File

@ -0,0 +1,11 @@
---
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"
'1.2.10': "{{ containerd_package }}=1.2.10-3"
'1.2.12': "{{ containerd_package }}=1.2.12-1"
'1.2.13': "{{ containerd_package }}=1.2.13-2"
'stable': "{{ containerd_package }}=1.2.13-2"
'edge': "{{ containerd_package }}=1.2.13-2"

View File

@ -0,0 +1,8 @@
---
containerd_versioned_pkg:
'latest': "{{ containerd_package }}"
'1.2.10': "{{ containerd_package }}-1.2.10-3.2.fc{{ ansible_distribution_major_version }}"
'1.2.12': "{{ containerd_package }}-1.2.12-3.1.fc{{ ansible_distribution_major_version }}"
'1.2.13': "{{ containerd_package }}-1.2.13-3.2.fc{{ ansible_distribution_major_version }}"
'stable': "{{ containerd_package }}-1.2.13-3.2.fc{{ ansible_distribution_major_version }}"
'edge': "{{ containerd_package }}-1.2.13-3.2.fc{{ ansible_distribution_major_version }}"

View File

@ -0,0 +1,11 @@
---
containerd_versioned_pkg:
'latest': "{{ containerd_package }}"
'1.2.4': "{{ containerd_package }}-1.2.4-3.1.el7"
'1.2.5': "{{ containerd_package }}-1.2.5-3.1.el7"
'1.2.6': "{{ containerd_package }}-1.2.6-3.3.el7"
'1.2.10': "{{ containerd_package }}-1.2.10-3.2.el7"
'1.2.12': "{{ containerd_package }}-1.2.12-3.1.el7"
'1.2.13': "{{ containerd_package }}-1.2.13-3.2.el7"
'stable': "{{ containerd_package }}-1.2.13-3.2.el7"
'edge': "{{ containerd_package }}-1.2.13-3.2.el7"

View File

@ -0,0 +1,11 @@
---
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"
'1.2.10': "{{ containerd_package }}=1.2.10-3"
'1.2.12': "{{ containerd_package }}=1.2.12-1"
'1.2.13': "{{ containerd_package }}=1.2.13-2"
'stable': "{{ containerd_package }}=1.2.13-2"
'edge': "{{ containerd_package }}=1.2.13-2"

View File

@ -0,0 +1,8 @@
---
containerd_versioned_pkg:
'latest': "{{ containerd_package }}"
'1.2.10': "{{ containerd_package }}=1.2.10-3"
'1.2.12': "{{ containerd_package }}=1.2.12-1"
'1.2.13': "{{ containerd_package }}=1.2.13-2"
'stable': "{{ containerd_package }}=1.2.13-2"
'edge': "{{ containerd_package }}=1.2.13-2"

View File

@ -11,9 +11,6 @@ containerd_config:
# containerd: # containerd:
# snapshotter: native # snapshotter: native
containerd_version: '1.2.13'
containerd_package: 'containerd.io'
containerd_cfg_dir: /etc/containerd containerd_cfg_dir: /etc/containerd
# Path to runc binary # Path to runc binary

View File

@ -0,0 +1,3 @@
---
dependencies:
- role: container-engine/containerd-common

View File

@ -22,9 +22,10 @@
delegate_to: "{{ inventory_hostname }}" delegate_to: "{{ inventory_hostname }}"
- name: Get crictl completion - name: Get crictl completion
shell: "{{ bin_dir }}/crictl completion" command: "{{ bin_dir }}/crictl completion"
changed_when: False changed_when: False
register: cri_completion register: cri_completion
check_mode: False
- name: Install crictl completion - name: Install crictl completion
copy: copy:

View File

@ -1,16 +1,4 @@
--- ---
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"
'1.2.10': "{{ containerd_package }}=1.2.10-3"
'1.2.12': "{{ containerd_package }}=1.2.12-1"
'1.2.13': "{{ containerd_package }}=1.2.13-2"
'stable': "{{ containerd_package }}=1.2.13-2"
'edge': "{{ containerd_package }}=1.2.13-2"
containerd_package_info: containerd_package_info:
pkg_mgr: apt pkg_mgr: apt
pkgs: pkgs:

View File

@ -1,13 +1,4 @@
--- ---
containerd_versioned_pkg:
'latest': "{{ containerd_package }}"
'1.2.10': "{{ containerd_package }}-1.2.10-3.2.fc{{ ansible_distribution_major_version }}"
'1.2.12': "{{ containerd_package }}-1.2.12-3.2.fc{{ ansible_distribution_major_version }}"
'1.2.13': "{{ containerd_package }}-1.2.13-3.2.fc{{ ansible_distribution_major_version }}"
'stable': "{{ containerd_package }}-1.2.13-3.2.fc{{ ansible_distribution_major_version }}"
'edge': "{{ containerd_package }}-1.2.13-3.2.fc{{ ansible_distribution_major_version }}"
containerd_package_info: containerd_package_info:
pkg_mgr: dnf pkg_mgr: dnf
pkgs: pkgs:

View File

@ -1,16 +1,4 @@
--- ---
containerd_versioned_pkg:
'latest': "{{ containerd_package }}"
'1.2.4': "{{ containerd_package }}-1.2.4-3.1.el7"
'1.2.5': "{{ containerd_package }}-1.2.5-3.1.el7"
'1.2.6': "{{ containerd_package }}-1.2.6-3.3.el7"
'1.2.10': "{{ containerd_package }}-1.2.10-3.2.el7"
'1.2.12': "{{ containerd_package }}-1.2.12-3.1.el7"
'1.2.13': "{{ containerd_package }}-1.2.13-3.2.el7"
'stable': "{{ containerd_package }}-1.2.13-3.2.el7"
'edge': "{{ containerd_package }}-1.2.13-3.2.el7"
containerd_package_info: containerd_package_info:
pkg_mgr: yum pkg_mgr: yum
pkgs: pkgs:

View File

@ -1,16 +1,4 @@
--- ---
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"
'1.2.10': "{{ containerd_package }}=1.2.10-3"
'1.2.12': "{{ containerd_package }}=1.2.12-1"
'1.2.13': "{{ containerd_package }}=1.2.13-2"
'stable': "{{ containerd_package }}=1.2.13-2"
'edge': "{{ containerd_package }}=1.2.13-2"
containerd_package_info: containerd_package_info:
pkg_mgr: apt pkg_mgr: apt
pkgs: pkgs:

View File

@ -1,4 +1,5 @@
--- ---
dependencies: dependencies:
- role: container-engine/containerd-common
- role: container-engine/docker-storage - role: container-engine/docker-storage
when: docker_container_storage_setup and ansible_os_family == "RedHat" when: docker_container_storage_setup and ansible_os_family == "RedHat"

View File

@ -196,6 +196,7 @@
- docker_task_result is failed - docker_task_result is failed
- ansible_distribution == 'Ubuntu' - ansible_distribution == 'Ubuntu'
register: available_packages register: available_packages
check_mode: false
- name: show available packages on ubuntu - name: show available packages on ubuntu
fail: fail:
@ -239,6 +240,7 @@
command: "docker version -f '{{ '{{' }}.Client.Version{{ '}}' }}'" command: "docker version -f '{{ '{{' }}.Client.Version{{ '}}' }}'"
register: installed_docker_version register: installed_docker_version
changed_when: false changed_when: false
check_mode: false
- name: check minimum docker version for docker_dns mode. You need at least docker version >= 1.12 for resolvconf_mode=docker_dns - name: check minimum docker version for docker_dns mode. You need at least docker version >= 1.12 for resolvconf_mode=docker_dns
fail: fail:

View File

@ -17,6 +17,7 @@
register: systemd_version register: systemd_version
when: not is_ostree when: not is_ostree
changed_when: false changed_when: false
check_mode: false
- name: Write docker.service systemd file - name: Write docker.service systemd file
template: template:

View File

@ -24,6 +24,8 @@ docker_cli_versioned_pkg:
docker_package_info: docker_package_info:
pkg_mgr: apt pkg_mgr: apt
pkgs: pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
force: yes
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" - name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
force: yes force: yes
- name: "{{ docker_versioned_pkg[docker_version | string] }}" - name: "{{ docker_versioned_pkg[docker_version | string] }}"

View File

@ -21,5 +21,6 @@ docker_cli_versioned_pkg:
docker_package_info: docker_package_info:
pkg_mgr: dnf pkg_mgr: dnf
pkgs: pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" - name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
- name: "{{ docker_versioned_pkg[docker_version | string] }}" - name: "{{ docker_versioned_pkg[docker_version | string] }}"

View File

@ -35,6 +35,8 @@ docker_pkgs_use_docker_ce:
yum_conf: "{{ docker_yum_conf }}" yum_conf: "{{ docker_yum_conf }}"
docker_pkgs: docker_pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
yum_conf: "{{ docker_yum_conf }}"
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" - name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
yum_conf: "{{ docker_yum_conf }}" yum_conf: "{{ docker_yum_conf }}"
- name: "{{ docker_versioned_pkg[docker_version | string] }}" - name: "{{ docker_versioned_pkg[docker_version | string] }}"

View File

@ -24,6 +24,8 @@ docker_cli_versioned_pkg:
docker_package_info: docker_package_info:
pkg_mgr: apt pkg_mgr: apt
pkgs: pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
force: yes
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" - name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
force: yes force: yes
- name: "{{ docker_versioned_pkg[docker_version | string] }}" - name: "{{ docker_versioned_pkg[docker_version | string] }}"

View File

@ -20,6 +20,8 @@ docker_cli_versioned_pkg:
docker_package_info: docker_package_info:
pkg_mgr: apt pkg_mgr: apt
pkgs: pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
force: yes
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" - name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
force: yes force: yes
- name: "{{ docker_versioned_pkg[docker_version | string] }}" - name: "{{ docker_versioned_pkg[docker_version | string] }}"