Make Docker and Podman play nice (#65009)

podman 1.4 now installs docker man pages. Add handler to remove docker packages to avoid test failure due to this conflict.

Adjust inventory_docker_swarm integration test
Add conditional to cleanup handlers to allow use of the setup_docker role without removing packages at the end of the play. The inventory_docker_swarm integration tests does its own cleanup.
pull/65025/head
Sam Doran 5 years ago committed by GitHub
parent 163904fe37
commit 6b2b876d43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,9 +1,18 @@
---
- hosts: 127.0.0.1
connection: local
gather_facts: no
gather_facts: yes
tasks:
- name: Make sure swarm is removed
docker_swarm:
state: absent
force: yes
- name: remove docker pagkages
action: "{{ ansible_facts.pkg_mgr }}"
args:
name:
- docker
- docker-ce
- docker-ce-cli
state: absent

@ -1,10 +1,14 @@
---
- hosts: 127.0.0.1
connection: local
vars:
docker_skip_cleanup: yes
tasks:
- name: Setup docker
include_role:
import_role:
name: setup_docker
- name: Create a Swarm cluster
docker_swarm:
state: present

@ -1,6 +1,7 @@
docker_cli_version: '0.0'
docker_api_version: '0.0'
docker_py_version: '0.0'
docker_skip_cleanup: no
docker_prereq_packages: []
docker_packages:
- docker-ce
@ -8,3 +9,8 @@ docker_packages:
docker_pip_extra_packages: []
docker_pip_packages:
- docker
docker_cleanup_packages:
- docker
- docker-ce
- docker-ce-cli

@ -0,0 +1,14 @@
- name: remove pip packages
pip:
state: present
name: "{{ docker_pip_packages | union(docker_pip_extra_packages) }}"
listen: cleanup docker
when: not docker_skip_cleanup | bool
- name: remove docker pagkages
action: "{{ ansible_facts.pkg_mgr }}"
args:
name: "{{ docker_cleanup_packages }}"
state: absent
listen: cleanup docker
when: not docker_skip_cleanup | bool

@ -7,6 +7,7 @@
name: "{{ docker_prereq_packages }}"
state: present
update_cache: yes
notify: cleanup docker
- name: Add gpg key
shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg >key && apt-key add key

@ -18,3 +18,4 @@
name: "{{ docker_packages }}"
state: present
enablerepo: docker-ce-test
notify: cleanup docker

@ -5,6 +5,7 @@
yum:
name: "{{ docker_prereq_packages }}"
state: present
notify: cleanup docker
- name: Install epel repo which is missing on rhel-7 and is needed for pigz (needed for docker-ce 18)
include_role:
@ -29,6 +30,7 @@
yum:
name: "{{ docker_packages }}"
state: present
notify: cleanup docker
- name: Make sure the docker daemon is running (failure expected inside docker container)
service:

@ -5,6 +5,7 @@
dnf:
name: "{{ docker_prereq_packages }}"
state: present
notify: cleanup docker
- name: Set-up repository
command: dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
@ -15,6 +16,7 @@
dnf:
name: "{{ docker_packages }}"
state: present
notify: cleanup docker
- name: Make sure the docker daemon is running (failure expected inside docker container)
service:

@ -4,3 +4,4 @@
force: yes
disable_gpg_check: yes
update_cache: yes
notify: cleanup docker

@ -12,7 +12,7 @@
- "{{ ansible_facts.os_family }}.yml"
- default.yml
paths:
- vars
- "{{ role_path }}/vars"
- name: Include distribution specific tasks
include_tasks: "{{ lookup('first_found', params) }}"
@ -24,13 +24,14 @@
- "{{ ansible_facts.distribution }}.yml"
- "{{ ansible_facts.os_family }}.yml"
paths:
- tasks
- "{{ role_path }}/tasks"
- name: Install Python requirements
pip:
state: present
name: "{{ docker_pip_packages | union(docker_pip_extra_packages) }}"
extra_args: "-c {{ remote_constraints }}"
notify: cleanup docker
# Detect docker CLI, API and docker-py versions
- name: Check Docker CLI version

@ -0,0 +1,9 @@
- name: remove podman packages
yum:
name: 'podman*'
state: absent
listen: cleanup podman
- name: remove extras repo
command: "{{ repo_command[ansible_facts.distribution ~ ansible_facts.distribution_major_version]['disable'] | default('echo') }}"
listen: cleanup podman

@ -1,12 +1,14 @@
- block:
- name: Enable extras repo
command: "{{ repo_command[ansible_facts.distribution ~ ansible_facts.distribution_major_version] | default('echo') }}"
command: "{{ repo_command[ansible_facts.distribution ~ ansible_facts.distribution_major_version]['enable'] | default('echo') }}"
notify: cleanup podman
- name: Install podman
yum:
name: "{{ podman_package }}"
state: present
when: ansible_facts.pkg_mgr in ['yum', 'dnf']
notify: cleanup podman
- name: Get podman version
command: podman --version

@ -1,2 +1,4 @@
repo_command:
RedHat7: yum-config-manager --enable rhui-REGION-rhel-server-extras
RedHat7:
enable: yum-config-manager --enable rhui-REGION-rhel-server-extras
disable: yum-config-manager --disable rhui-REGION-rhel-server-extras

Loading…
Cancel
Save