mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-17 20:38:42 +00:00
* Add docker_compose_v2 module. * Add note on compatibility. * Parse more events. Emit warnings (or things we assume are warnings), and report unparsable messages to the user so they can report them to us.
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
---
|
|
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
####################################################################
|
|
# WARNING: These are designed specifically for Ansible tests #
|
|
# and should not be used as examples of how to write Ansible roles #
|
|
####################################################################
|
|
|
|
# Create random name prefix (for services, ...)
|
|
- name: Create random container name prefix
|
|
set_fact:
|
|
name_prefix: "{{ 'ansible-docker-test-%0x' % ((2**32) | random) }}"
|
|
cnames: []
|
|
dnetworks: []
|
|
|
|
- debug:
|
|
msg: "Using name prefix {{ name_prefix }}"
|
|
|
|
# Run the tests
|
|
- block:
|
|
- command: docker compose --help
|
|
|
|
- include_tasks: run-test.yml
|
|
with_fileglob:
|
|
- "tests/*.yml"
|
|
loop_control:
|
|
loop_var: test_name
|
|
|
|
always:
|
|
- name: "Make sure all containers are removed"
|
|
docker_container:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
force_kill: true
|
|
with_items: "{{ cnames }}"
|
|
diff: false
|
|
|
|
- name: "Make sure all networks are removed"
|
|
docker_network:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
force: true
|
|
with_items: "{{ dnetworks }}"
|
|
diff: false
|
|
|
|
when: docker_has_compose and docker_compose_version is version('2.18.0', '>=')
|