This commit is contained in:
@@ -50,23 +50,22 @@
|
|||||||
register: compose_output
|
register: compose_output
|
||||||
|
|
||||||
- name: Get container info
|
- name: Get container info
|
||||||
community.docker.docker_container_info:
|
community.docker.docker_host_info:
|
||||||
filters:
|
containers: true
|
||||||
label:
|
containers_all: true
|
||||||
- "com.docker.compose.project={{ project_name }}"
|
register: host_info
|
||||||
register: container_info
|
until: (host_info.ansible_facts.docker_containers | selectattr('Labels.com.docker.compose.project', 'equalto', project_name) | list | length) >= 2
|
||||||
until: container_info.containers | length >= 2 # Assuming 2 services (web and db)
|
|
||||||
retries: 10
|
retries: 10
|
||||||
delay: 5
|
delay: 5
|
||||||
|
|
||||||
- name: Debug container_info
|
- name: Debug container_info
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
var: container_info
|
var: host_info.ansible_facts.docker_containers
|
||||||
|
|
||||||
- name: Verify that web and db services are running
|
- name: Verify that web and db services are running
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- (container_info.containers | selectattr('name', 'match', '.*-web-.*') | first).State.Running
|
- (host_info.ansible_facts.docker_containers | selectattr('Labels.com.docker.compose.project', 'equalto', project_name) | selectattr('Names', 'match', '.*-web-.*') | first).State.Running
|
||||||
- (container_info.containers | selectattr('name', 'match', '.*-db-.*') | first).State.Running
|
- (host_info.ansible_facts.docker_containers | selectattr('Labels.com.docker.compose.project', 'equalto', project_name) | selectattr('Names', 'match', '.*-db-.*') | first).State.Running
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user