Added app validation, ignores errors on prune

This commit is contained in:
2026-02-28 13:23:20 -05:00
parent 466607d477
commit 0bbeb4d8cf
2 changed files with 16 additions and 0 deletions

View File

@@ -41,3 +41,18 @@
networks: true
volumes: true
builder_cache: true
- name: Get status of all containers
community.docker.docker_host_info:
containers: true
containers_all: true
register: docker_info
- name: Identify containers not in running state
ansible.builtin.set_fact:
not_up_containers: "{{ docker_info.containers | selectattr('State', 'ne', 'running') | map(attribute='Names') | flatten | map('regex_replace', '^/', '') | list }}"
- name: Report containers not in running state
ansible.builtin.debug:
msg: "WARNING: The following containers are not running on {{ inventory_hostname }}: {{ not_up_containers | join(', ') }}"
when: not_up_containers | length > 0