mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 19:57:58 +00:00
Use FQCNs. (#1180)
This commit is contained in:
@@ -9,36 +9,36 @@
|
||||
####################################################################
|
||||
|
||||
- name: Gather facts on controller
|
||||
setup:
|
||||
ansible.builtin.setup:
|
||||
gather_subset: '!all'
|
||||
delegate_to: localhost
|
||||
delegate_facts: true
|
||||
run_once: true
|
||||
|
||||
- name: Make sure ipaddress is available on controller
|
||||
pip:
|
||||
ansible.builtin.pip:
|
||||
name: ipaddress
|
||||
delegate_to: localhost
|
||||
when: hostvars['localhost'].ansible_facts.python.version.major < 3
|
||||
|
||||
# Create random name prefix (for containers, networks, ...)
|
||||
- name: Create random container name prefix
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
cname_prefix: "{{ 'ansible-docker-test-%0x' % ((2**32) | random) }}"
|
||||
cnames: []
|
||||
inames: []
|
||||
dnetworks: []
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "Using container name prefix {{ cname_prefix }}"
|
||||
|
||||
- name: Retrieve docker host info
|
||||
docker_host_info:
|
||||
community.docker.docker_host_info:
|
||||
register: docker_host_info
|
||||
|
||||
# Run the tests
|
||||
- block:
|
||||
- include_tasks: run-test.yml
|
||||
- ansible.builtin.include_tasks: run-test.yml
|
||||
with_fileglob:
|
||||
- "tests/*.yml"
|
||||
loop_control:
|
||||
@@ -46,18 +46,18 @@
|
||||
|
||||
always:
|
||||
- name: "Make sure all containers are removed"
|
||||
docker_container:
|
||||
community.docker.docker_container:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
force_kill: true
|
||||
with_items: "{{ cnames }}"
|
||||
diff: false
|
||||
- name: "Make sure all images are removed"
|
||||
docker_image_remove:
|
||||
community.docker.docker_image_remove:
|
||||
name: "{{ item }}"
|
||||
with_items: "{{ inames }}"
|
||||
- name: "Make sure all networks are removed"
|
||||
docker_network:
|
||||
community.docker.docker_network:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
force: true
|
||||
@@ -66,5 +66,5 @@
|
||||
|
||||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- fail: msg="Too old docker / docker-py version to run all docker_container tests!"
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run all docker_container tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
|
||||
Reference in New Issue
Block a user