Check if docker enabled before stopping all containers.
The set of tasks in tripleo-podman/tasks/tripleo_docker_stop.yml are being used during the upgrade to ensure that all services are stopped when upgrading from Rocky to Stein. However, in Train docker does not have to be installed in the system and this task would fail. Adding a check before to stop the services only if docker is installed. Change-Id: I05fa46d3b53ece83867a2ccd5c931b0cac1209d4
This commit is contained in:
parent
4344c5a7ac
commit
282adce74b
@ -21,12 +21,20 @@
|
||||
- system_upgrade_prepare
|
||||
become: true
|
||||
block:
|
||||
- name: Check if docker is enabled in the system
|
||||
stat:
|
||||
path: "/var/run/docker.sock"
|
||||
register: check_docker
|
||||
failed_when: false
|
||||
|
||||
- name: Stop all services by stopping all Docker containers
|
||||
command: docker ps -aq
|
||||
register: running_containers
|
||||
when: check_docker.stat.exists
|
||||
|
||||
- name: Stop a container
|
||||
docker_container:
|
||||
name: "{{ item }}"
|
||||
state: stopped
|
||||
loop: "{{ running_containers.stdout_lines | default([]) }}"
|
||||
when: check_docker.stat.exists
|
||||
|
Loading…
Reference in New Issue
Block a user