Debian Codegraph @

ansible_collections/community/docker/tests/integration/targets/docker_context_info/tasks/main.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 ####################################################################
7 # WARNING: These are designed specifically for Ansible tests #
8 # and should not be used as examples of how to write Ansible roles #
9 ####################################################################
10
11 # Create random name prefix (for containers, networks, ...)
12 - name: Create random container name prefix
13 ansible.builtin.set_fact:
14 cname_prefix: "{{ 'ansible-docker-test-%0x' % ((2**32) | random) }}"
15 cnames: []
16
17 - ansible.builtin.debug:
18 msg: "Using container name prefix {{ cname_prefix }}"
19
20 # Run the tests
21 - block:
22 - ansible.builtin.include_tasks: run-test.yml
23 with_fileglob:
24 - "tests/*.yml"
25 loop_control:
26 loop_var: test_name
27
28 always:
29 - name: "Make sure all containers are removed"
30 community.docker.docker_container:
31 name: "{{ item }}"
32 state: absent
33 force_kill: true
34 with_items: "{{ cnames }}"
35 diff: false
36
37 when: docker_api_version is version('1.25', '>=')
38
39 - ansible.builtin.fail: msg="Too old docker / docker-py version to run all docker_container tests!"
40 when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)