Skip to content

Commit

Permalink
Fix docker_compose_v2 example. (#917)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein authored Jul 6, 2024
1 parent 48c0cdf commit 259f2cf
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions plugins/modules/docker_compose_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,13 @@
- name: Verify that web and db services are not running
ansible.builtin.assert:
that:
- "not output.services.web.flask_web_1.state.running"
- "not output.services.db.flask_db_1.state.running"
- web_container.State != 'running'
- db_container.State != 'running'
vars:
web_container: >-
{{ output.containers | selectattr("Service", "equalto", "web") | first }}
db_container: >-
{{ output.containers | selectattr("Service", "equalto", "db") | first }}
- name: Restart services
community.docker.docker_compose_v2:
Expand All @@ -210,8 +215,13 @@
- name: Verify that web and db services are running
ansible.builtin.assert:
that:
- "output.services.web.flask_web_1.state.running"
- "output.services.db.flask_db_1.state.running"
- web_container.State == 'running'
- db_container.State == 'running'
vars:
web_container: >-
{{ output.containers | selectattr("Service", "equalto", "web") | first }}
db_container: >-
{{ output.containers | selectattr("Service", "equalto", "db") | first }}
'''

RETURN = '''
Expand Down

0 comments on commit 259f2cf

Please sign in to comment.