This commit is contained in:
@@ -51,10 +51,13 @@
|
||||
|
||||
- name: Get container info
|
||||
community.docker.docker_container_info:
|
||||
name:
|
||||
- "{{ project_name }}-web-1"
|
||||
- "{{ project_name }}-db-1"
|
||||
filters:
|
||||
label:
|
||||
- "com.docker.compose.project={{ project_name }}"
|
||||
register: container_info
|
||||
until: container_info.containers | length >= 2 # Assuming 2 services (web and db)
|
||||
retries: 10
|
||||
delay: 5
|
||||
|
||||
- name: Debug container_info
|
||||
ansible.builtin.debug:
|
||||
@@ -63,8 +66,7 @@
|
||||
- name: Verify that web and db services are running
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- container_info.containers is defined
|
||||
- (container_info.containers | selectattr('name', 'equalto', '{{ project_name }}-web-1') | first).State.Running
|
||||
- (container_info.containers | selectattr('name', 'equalto', '{{ project_name }}-db-1') | first).State.Running
|
||||
- (container_info.containers | selectattr('name', 'match', '.*-web-.*') | first).State.Running
|
||||
- (container_info.containers | selectattr('name', 'match', '.*-db-.*') | first).State.Running
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user