app-validation #1
@@ -43,14 +43,13 @@
|
|||||||
builder_cache: true
|
builder_cache: true
|
||||||
|
|
||||||
- name: Get status of all containers
|
- name: Get status of all containers
|
||||||
community.docker.docker_host_info:
|
ansible.builtin.command: "docker ps -a --format {{ '{{' }}.Names{{ '}}' }}|{{ '{{' }}.State{{ '}}' }}"
|
||||||
containers: true
|
register: container_statuses
|
||||||
containers_all: true
|
changed_when: false
|
||||||
register: docker_info
|
|
||||||
|
|
||||||
- name: Identify containers not in running state
|
- name: Identify containers not in running state
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
not_up_containers: "{{ docker_info.containers | selectattr('State', 'ne', 'running') | map(attribute='Names') | flatten | map('regex_replace', '^/', '') | list }}"
|
not_up_containers: "{{ container_statuses.stdout_lines | reject('search', '\\|running$') | map('split', '|') | map('first') | list }}"
|
||||||
|
|
||||||
- name: Report containers not in running state
|
- name: Report containers not in running state
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
|
|||||||
Reference in New Issue
Block a user