install-docker: allow removal of conflicting packages
Allow us to define which packages need to be removed before installing the desired ones. Fixes use of role on systems where it was desired to install upstream docker but the system one was already installed. Change-Id: Ib6ae0a8fba937901b29565e2d36486eccf4f67bb
This commit is contained in:
parent
4b23fe8b64
commit
cce6535468
@ -68,6 +68,14 @@ An ansible role to install docker and configure it to use mirrors if available.
|
||||
installed prior to installing docker-ce. If the package set needs to
|
||||
be changed this option can be overridden as needed.
|
||||
|
||||
.. zuul:rolevar:: docker_upstream_distro_remove_packages
|
||||
:default: list
|
||||
|
||||
List of packages to be removed before installing new ones. It is used
|
||||
for avoiding potential conflicts. For example it can remove `docker`
|
||||
package before trying to install `docker-ce`. The default value is
|
||||
distro specific.
|
||||
|
||||
.. zuul:rolevar:: docker_upstream_distro_packages
|
||||
:default: list
|
||||
|
||||
|
@ -8,6 +8,7 @@ docker_distro_packages: "{{ _docker_distro_packages | default([]) }}"
|
||||
docker_compose_install: false
|
||||
docker_upstream_distro_packages: "{{ _docker_upstream_distro_packages | default([]) }}"
|
||||
docker_upstream_distro_required_packages: "{{ _docker_upstream_distro_required_packages | default([]) }}"
|
||||
docker_upstream_distro_remove_packages: "{{ _docker_upstream_distro_remove_packages | default([]) }}"
|
||||
docker_update_channel: stable
|
||||
docker_download_fqdn: download.docker.com
|
||||
docker_mirror_base_url: "{{ _docker_mirror_base_url | default('') }}"
|
||||
|
@ -1,4 +1,10 @@
|
||||
---
|
||||
- name: Remove packages
|
||||
package:
|
||||
name: "{{ docker_upstream_distro_remove_packages }}"
|
||||
state: absent
|
||||
when: docker_upstream_distro_remove_packages
|
||||
|
||||
# package/dnf module do not support `--nobest` option which is needed for
|
||||
# installing docker-ce on centos-8
|
||||
- name: Install upstream docker using package
|
||||
|
@ -14,6 +14,9 @@ _docker_upstream_distro_packages:
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
|
||||
_docker_upstream_distro_remove_packages:
|
||||
- docker.io
|
||||
|
||||
docker_distro_vars_loaded: true
|
||||
|
||||
_docker_mirror_base_url: "https://{{ docker_download_fqdn }}/linux/debian"
|
||||
|
@ -11,6 +11,9 @@ _docker_upstream_distro_packages:
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
|
||||
_docker_upstream_distro_remove_packages:
|
||||
- docker
|
||||
|
||||
docker_repo_template: docker-ce-fedora.repo.j2
|
||||
|
||||
docker_distro_vars_loaded: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user