Browse Source

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
tags/0.3.0
Jose Luis Franco Arza 1 week ago
parent
commit
282adce74b

+ 8
- 0
tripleo_ansible/roles/tripleo-podman/tasks/tripleo_docker_stop.yml View File

@@ -21,12 +21,20 @@
21 21
     - system_upgrade_prepare
22 22
   become: true
23 23
   block:
24
+    - name: Check if docker is enabled in the system
25
+      stat:
26
+        path: "/var/run/docker.sock"
27
+      register: check_docker
28
+      failed_when: false
29
+
24 30
     - name: Stop all services by stopping all Docker containers
25 31
       command: docker ps -aq
26 32
       register: running_containers
33
+      when: check_docker.stat.exists
27 34
 
28 35
     - name: Stop a container
29 36
       docker_container:
30 37
         name: "{{ item }}"
31 38
         state: stopped
32 39
       loop: "{{ running_containers.stdout_lines | default([]) }}"
40
+      when: check_docker.stat.exists

Loading…
Cancel
Save