Use FQCNs. (#1180)

This commit is contained in:
Felix Fontein
2025-10-25 10:12:21 +02:00
committed by GitHub
parent be000755fc
commit b24bce77b6
196 changed files with 3289 additions and 3289 deletions
@@ -8,10 +8,10 @@
# and should not be used as examples of how to write Ansible roles #
####################################################################
- include_tasks: test_host_info.yml
- ansible.builtin.include_tasks: test_host_info.yml
when: docker_api_version is version('1.25', '>=')
- fail: msg="Too old docker / docker-py version to run docker_host_info tests!"
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_host_info tests!"
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
- when: podman_cli_version is version('1.0.0', '>=')
@@ -27,11 +27,11 @@
block:
- name: Get info on Podman host
docker_host_info:
community.docker.docker_host_info:
register: output
- name: Check for some Podman specific values
assert:
ansible.builtin.assert:
that:
- output.host_info.ProductLicense == 'Apache-2.0'
- >-
@@ -4,21 +4,21 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Create random container/volume name
set_fact:
ansible.builtin.set_fact:
cname: "{{ 'ansible-docker-test-%0x' % ((2**32) | random) }}"
cname2: "{{ 'ansible-docker-test-%0x' % ((2**32) | random) }}"
vname: "{{ 'ansible-docker-test-%0x' % ((2**32) | random) }}"
- debug:
- ansible.builtin.debug:
msg: "Using container names '{{ cname }}' and '{{ cname2 }}', and volume name '{{ vname }}'"
- block:
- name: Get info on Docker host
docker_host_info:
community.docker.docker_host_info:
register: output
- name: assert reading docker host facts when docker is running
assert:
ansible.builtin.assert:
that:
- output.host_info.Name is string
- output.containers is not defined
@@ -30,26 +30,26 @@
- block:
- name: Get info on Docker host with invalid api_version
docker_host_info:
community.docker.docker_host_info:
api_version: 1.999.999
register: output
ignore_errors: true
- name: assert can_talk_is_docker is false
assert:
ansible.builtin.assert:
that:
- output is failed
- output.can_talk_to_docker is false
- block:
- name: Get info on Docker host with invalid docker_host
docker_host_info:
community.docker.docker_host_info:
docker_host: tcp://127.0.0.1:80
register: output
ignore_errors: true
- name: assert can_talk_is_docker is false
assert:
ansible.builtin.assert:
that:
- output is failed
- output.can_talk_to_docker is false
@@ -59,7 +59,7 @@
# * image list is non-empty because the image of the container is there;
# * network list is always non-empty (default networks).
- name: Create running container
docker_container:
community.docker.docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
@@ -70,7 +70,7 @@
register: container_output
- name: Create running container
docker_container:
community.docker.docker_container:
image: "{{ docker_test_image_alpine }}"
name: "{{ cname2 }}"
labels:
@@ -79,27 +79,27 @@
state: stopped
register: container2_output
- assert:
- ansible.builtin.assert:
that:
- container_output is changed
- container2_output is changed
- name: Create a volume
docker_volume:
community.docker.docker_volume:
name: "{{ vname }}"
register: volume_output
- assert:
- ansible.builtin.assert:
that:
- volume_output is changed
- name: Get info on Docker host and list containers
docker_host_info:
community.docker.docker_host_info:
containers: true
register: output
- name: assert reading docker host facts when docker is running and list containers
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.networks is not defined'
@@ -110,18 +110,18 @@
- 'output.containers[0].ImageID is not defined'
- name: Get info on Docker host and list containers matching filters (single label)
docker_host_info:
community.docker.docker_host_info:
containers: true
containers_filters:
label: key1=value1
register: output
- name: assert container is returned when filters are matched (single label)
assert:
ansible.builtin.assert:
that: "output.containers | length == 1"
- name: Get info on Docker host and list containers matching filters (multiple labels)
docker_host_info:
community.docker.docker_host_info:
containers: true
containers_filters:
label:
@@ -130,11 +130,11 @@
register: output
- name: assert container is returned when filters are matched (multiple labels)
assert:
ansible.builtin.assert:
that: "output.containers | length == 1"
- name: Get info on Docker host and do not list containers which do not match filters
docker_host_info:
community.docker.docker_host_info:
containers: true
containers_filters:
label:
@@ -144,11 +144,11 @@
register: output
- name: assert no container is returned when filters are not matched
assert:
ansible.builtin.assert:
that: "output.containers | length == 0"
- name: Get info on Docker host and list containers matching filters (single label, not all containers)
docker_host_info:
community.docker.docker_host_info:
containers: true
containers_all: false
containers_filters:
@@ -156,7 +156,7 @@
register: output
- name: Get info on Docker host and list containers matching filters (single label, all containers)
docker_host_info:
community.docker.docker_host_info:
containers: true
containers_all: true
containers_filters:
@@ -164,19 +164,19 @@
register: output_all
- name: assert one resp. two container is returned
assert:
ansible.builtin.assert:
that:
- "output.containers | length == 1"
- "output_all.containers | length == 2"
- name: Get info on Docker host and list containers with verbose output
docker_host_info:
community.docker.docker_host_info:
containers: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and list containers with verbose output
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.networks is not defined'
@@ -187,12 +187,12 @@
- 'output.containers[0].ImageID is string'
- name: Get info on Docker host and list images
docker_host_info:
community.docker.docker_host_info:
images: true
register: output
- name: assert reading docker host facts when docker is running and list images
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
@@ -203,13 +203,13 @@
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list images with verbose output
docker_host_info:
community.docker.docker_host_info:
images: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and list images with verbose output
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
@@ -220,12 +220,12 @@
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list networks
docker_host_info:
community.docker.docker_host_info:
networks: true
register: output
- name: assert reading docker host facts when docker is running and list networks
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
@@ -236,13 +236,13 @@
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list networks with verbose output
docker_host_info:
community.docker.docker_host_info:
networks: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and list networks with verbose output
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
@@ -253,12 +253,12 @@
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list volumes
docker_host_info:
community.docker.docker_host_info:
volumes: true
register: output
- name: assert reading docker host facts when docker is running and list volumes
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
@@ -269,13 +269,13 @@
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list volumes with verbose output
docker_host_info:
community.docker.docker_host_info:
volumes: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and list volumes with verbose output
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
@@ -286,12 +286,12 @@
- 'output.disk_usage is not defined'
- name: Get info on Docker host and get disk usage
docker_host_info:
community.docker.docker_host_info:
disk_usage: true
register: output
- name: assert reading docker host facts when docker is running and get disk usage
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
@@ -304,13 +304,13 @@
- 'output.disk_usage.Volumes is not defined'
- name: Get info on Docker host and get disk usage with verbose output
docker_host_info:
community.docker.docker_host_info:
disk_usage: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and get disk usage with verbose output
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
@@ -323,7 +323,7 @@
- 'output.disk_usage.Volumes is sequence'
- name: Get info on Docker host, disk usage and get all lists together
docker_host_info:
community.docker.docker_host_info:
volumes: true
containers: true
networks: true
@@ -332,7 +332,7 @@
register: output
- name: assert reading docker host facts when docker is running, disk usage and get lists together
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers[0].Image is string'
@@ -349,7 +349,7 @@
- 'output.disk_usage.Volumes is not defined'
- name: Get info on Docker host, disk usage and get all lists together with verbose output
docker_host_info:
community.docker.docker_host_info:
volumes: true
containers: true
networks: true
@@ -359,7 +359,7 @@
register: output
- name: assert reading docker host facts when docker is running and get disk usage with verbose output
assert:
ansible.builtin.assert:
that:
- 'output.host_info.Name is string'
- 'output.containers[0].Image is string'
@@ -377,7 +377,7 @@
always:
- name: Delete containers
docker_container:
community.docker.docker_container:
name: "{{ item }}"
state: absent
force_kill: true
@@ -386,6 +386,6 @@
- "{{ cname2 }}"
- name: Delete volume
docker_volume:
community.docker.docker_volume:
name: "{{ vname }}"
state: absent