Remove Docker when upgrading to Podman

When upgrading to Podman, we'll purge Docker resources with the prune
command. Then we'll stop Docker and remove the package.
Then remove /var/lib/docker.
It'll happen in post_upgrade_tasks.

blueprint podman-support
Change-Id: Idac992510a29e89ffa9d252e3c8f9fa89175b18a
This commit is contained in:
Emilien Macchi 2018-11-27 15:48:07 -05:00
parent 9c5e403e94
commit c86e81d35f

View File

@ -88,3 +88,36 @@ outputs:
- name: Delete cni0 interface if exists
command: ip link delete cni0
ignore_errors: True
post_upgrade_tasks:
- name: Purge everything about Docker on the host
when: step|int == 3
block:
- name: Check if docker has some data
stat:
path: /var/lib/docker
register: docker_path_stat
- name: Purge Docker
when: docker_path_stat.stat.exists
block:
- name: Ensure docker service is running
systemd:
name: docker
register: docker_service_state
- name: Run docker system prune
shell: docker system prune -a -f
when: docker_service_state.status['SubState'] == 'running'
- name: Stop and disable Docker service
when: docker_service_state.status['SubState'] == 'running'
systemd:
name: docker
state: stopped
enabled: no
- name: Uninstall Docker rpm
package:
name: docker
state: absent
- name: Purge /var/lib/docker
file:
path: /var/lib/docker
state: absent