Skip to content

Commit

Permalink
[common] Add debug to container tests when container is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
elfiesmelfie committed Feb 13, 2025
1 parent c651cc1 commit 9becdab
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions roles/common/tasks/container_test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
---
- block:
# The containers are run by root, so need to become true
- name: Get container status
become: true
ansible.builtin.shell:
cmd: |
podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep {{ container_name }}
changed_when: false
register: container_status
- name: Get container status
become: true
ansible.builtin.shell:
cmd: |
podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep {{ container_name }}
changed_when: false
register: container_status
rescue:
- name: Show the containers
ansible.builtin.shell:
cmd: |
podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}"
changed_when: false
register: debug_output

- name: Show the output of container list
ansible.builtin.debug:
var: debug_output.stdout_lines

# NOTE: leaving the existing fail message to get the status and see if it is okay
- name: |
Expand Down

0 comments on commit 9becdab

Please sign in to comment.