update ansible collections sops, docker and debops
This commit is contained in:
parent
f1135b818f
commit
e31ee5e39c
910 changed files with 27667 additions and 19786 deletions
|
|
@ -27,8 +27,8 @@
|
|||
- /proc/self/cgroup
|
||||
- /proc/self/cpuset
|
||||
- /proc/self/mountinfo
|
||||
ignore_errors: true # not all of these files always exist
|
||||
register: slurp
|
||||
ignore_errors: true
|
||||
|
||||
- name: Print files
|
||||
ansible.builtin.debug:
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_py_version is version('2.6.0', '>=') and docker_api_version is version('1.30', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_config tests!"
|
||||
when: not(docker_py_version is version('2.6.0', '>=') and docker_api_version is version('1.30', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_py_version is version('2.6.0', '>=') and docker_api_version is version('1.30', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
community.docker.docker_swarm:
|
||||
name: default
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
||||
- name: Parameter name should be required
|
||||
community.docker.docker_config: # noqa: args[module]
|
||||
|
|
|
|||
|
|
@ -70,4 +70,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- 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)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -957,7 +957,7 @@
|
|||
- when: device_read_bps_1 is failed
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'error setting cgroup config for procHooks process' in device_read_bps_1.msg and 'blkio.throttle.read_bps_device: no such device' in device_read_bps_1.msg"
|
||||
- "'error setting cgroup config for procHooks process' in device_read_bps_1.msg and ': no such device' in device_read_bps_1.msg"
|
||||
|
||||
####################################################################
|
||||
## device_read_iops ################################################
|
||||
|
|
@ -1040,7 +1040,7 @@
|
|||
- when: device_read_iops_1 is failed
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'error setting cgroup config for procHooks process' in device_read_iops_1.msg and 'blkio.throttle.read_iops_device: no such device' in device_read_iops_1.msg"
|
||||
- "'error setting cgroup config for procHooks process' in device_read_iops_1.msg and ': no such device' in device_read_iops_1.msg"
|
||||
|
||||
####################################################################
|
||||
## device_write_bps and device_write_iops ##########################
|
||||
|
|
@ -1110,7 +1110,7 @@
|
|||
- when: device_write_limit_1 is failed
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'error setting cgroup config for procHooks process' in device_write_limit_1.msg and 'blkio.throttle.write_bps_device: no such device' in device_write_limit_1.msg"
|
||||
- "'error setting cgroup config for procHooks process' in device_write_limit_1.msg and ': no such device' in device_write_limit_1.msg"
|
||||
|
||||
####################################################################
|
||||
## device_requests #################################################
|
||||
|
|
|
|||
|
|
@ -44,4 +44,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old Docker API version to run all docker_container_copy_into tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -243,4 +243,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_container_exec tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -81,4 +81,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_container_info tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -37,4 +37,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- 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)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- 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: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
||||
- when: podman_cli_version is version('1.0.0', '>=')
|
||||
block:
|
||||
|
|
|
|||
|
|
@ -53,4 +53,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -68,4 +68,4 @@
|
|||
when: docker_api_version is version('1.25', '>=') and docker_cli_version is version('19.03', '>=') and docker_has_buildx
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=') and docker_cli_version is version('19.03', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6) and docker_has_buildx
|
||||
when: not(docker_api_version is version('1.25', '>=') and docker_cli_version is version('19.03', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6) and docker_has_buildx
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
# 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
|
||||
|
||||
- when: docker_api_version is version('1.48', '>=')
|
||||
block:
|
||||
- name: Pull image for platform test
|
||||
community.docker.docker_image_pull:
|
||||
name: "{{ docker_test_image_hello_world }}"
|
||||
platform: linux/amd64
|
||||
|
||||
- name: Export image with platform (check mode)
|
||||
community.docker.docker_image_export:
|
||||
name: "{{ docker_test_image_hello_world }}"
|
||||
path: "{{ remote_tmp_dir }}/platform-test.tar"
|
||||
platform: linux/amd64
|
||||
register: result_check
|
||||
check_mode: true
|
||||
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- result_check is changed
|
||||
|
||||
- name: Export image with platform
|
||||
community.docker.docker_image_export:
|
||||
name: "{{ docker_test_image_hello_world }}"
|
||||
path: "{{ remote_tmp_dir }}/platform-test.tar"
|
||||
platform: linux/amd64
|
||||
register: result
|
||||
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
|
@ -57,4 +57,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image_info tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -303,4 +303,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image_info tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@
|
|||
dependencies:
|
||||
- setup_docker
|
||||
- setup_docker_python_deps
|
||||
- setup_utils
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
- info_1.images | length == 2
|
||||
- info_1.images[0].Id == pulled_images.results[0].image.Id
|
||||
- info_1.images[1].Id == pulled_images.results[0].image.Id
|
||||
- tag_1_check == tag_1
|
||||
- tag_1_check | internal__normalize_image("image") == tag_1 | internal__normalize_image("image")
|
||||
|
||||
- name: Tag image 1 (idempotent, check mode)
|
||||
community.docker.docker_image_tag:
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
- tag_2 is not changed
|
||||
- tag_2.diff.before == tag_2.diff.after
|
||||
- tag_2.diff.before.images | length == 2
|
||||
- tag_2_check == tag_2
|
||||
- tag_2_check | internal__normalize_image("image") == tag_2 | internal__normalize_image("image")
|
||||
|
||||
- name: Tag image 1 (idempotent, different input format, check mode)
|
||||
community.docker.docker_image_tag:
|
||||
|
|
@ -130,7 +130,7 @@
|
|||
- tag_3 is not changed
|
||||
- tag_3.diff.before == tag_3.diff.after
|
||||
- tag_3.diff.before.images | length == 2
|
||||
- tag_3_check == tag_3
|
||||
- tag_3_check | internal__normalize_image("image") == tag_3 | internal__normalize_image("image")
|
||||
|
||||
- name: Tag image 1 (one more, check mode)
|
||||
community.docker.docker_image_tag:
|
||||
|
|
@ -173,7 +173,7 @@
|
|||
- info_4.images[0].Id == pulled_images.results[0].image.Id
|
||||
- info_4.images[1].Id == pulled_images.results[0].image.Id
|
||||
- info_4.images[2].Id == pulled_images.results[0].image.Id
|
||||
- tag_4_check == tag_4
|
||||
- tag_4_check | internal__normalize_image("image") == tag_4 | internal__normalize_image("image")
|
||||
|
||||
- name: Tag image 2 (only change missing one, check mode)
|
||||
community.docker.docker_image_tag:
|
||||
|
|
@ -219,7 +219,7 @@
|
|||
- info_5.images[1].Id == pulled_images.results[0].image.Id
|
||||
- info_5.images[2].Id == pulled_images.results[1].image.Id
|
||||
- info_5.images[3].Id == pulled_images.results[0].image.Id
|
||||
- tag_5_check == tag_5
|
||||
- tag_5_check | internal__normalize_image("image") == tag_5 | internal__normalize_image("image")
|
||||
|
||||
- name: Tag image 2 (idempotent, check mode)
|
||||
community.docker.docker_image_tag:
|
||||
|
|
@ -249,7 +249,7 @@
|
|||
- tag_6 is not changed
|
||||
- tag_6.diff.before == tag_6.diff.after
|
||||
- tag_6.diff.before.images | length == 3
|
||||
- tag_6_check == tag_6
|
||||
- tag_6_check | internal__normalize_image("image") == tag_6 | internal__normalize_image("image")
|
||||
|
||||
- name: Tag image 2 (only change wrong ones, check mode)
|
||||
community.docker.docker_image_tag:
|
||||
|
|
@ -296,7 +296,7 @@
|
|||
- info_7.images[1].Id == pulled_images.results[1].image.Id
|
||||
- info_7.images[2].Id == pulled_images.results[1].image.Id
|
||||
- info_7.images[3].Id == pulled_images.results[0].image.Id
|
||||
- tag_7_check == tag_7
|
||||
- tag_7_check | internal__normalize_image("image") == tag_7 | internal__normalize_image("image")
|
||||
|
||||
- name: Tag image 2 (idempotent, check mode)
|
||||
community.docker.docker_image_tag:
|
||||
|
|
@ -326,7 +326,7 @@
|
|||
- tag_8 is not changed
|
||||
- tag_8.diff.before == tag_8.diff.after
|
||||
- tag_8.diff.before.images | length == 3
|
||||
- tag_8_check == tag_8
|
||||
- tag_8_check | internal__normalize_image("image") == tag_8 | internal__normalize_image("image")
|
||||
|
||||
- name: Tag image 3 (source image has digest)
|
||||
community.docker.docker_image_tag:
|
||||
|
|
@ -399,4 +399,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image_info tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -51,4 +51,4 @@
|
|||
when: docker_api_version is version('1.25', '>=') # FIXME: find out API version!
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_network tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@
|
|||
name: "{{ nname_ipam_3 }}"
|
||||
driver: "macvlan"
|
||||
driver_options:
|
||||
parent: "{{ ansible_default_ipv4.alias }}"
|
||||
parent: "{{ ansible_facts.default_ipv4.alias }}"
|
||||
ipam_config:
|
||||
- subnet: 10.26.120.0/24
|
||||
- subnet: 10.26.121.0/24
|
||||
|
|
@ -220,7 +220,7 @@
|
|||
name: "{{ nname_ipam_3 }}"
|
||||
driver: "macvlan"
|
||||
driver_options:
|
||||
parent: "{{ ansible_default_ipv4.alias }}"
|
||||
parent: "{{ ansible_facts.default_ipv4.alias }}"
|
||||
ipam_config:
|
||||
- subnet: 10.26.121.0/24
|
||||
- subnet: 10.26.120.0/24
|
||||
|
|
@ -235,7 +235,7 @@
|
|||
name: "{{ nname_ipam_3 }}"
|
||||
driver: "macvlan"
|
||||
driver_options:
|
||||
parent: "{{ ansible_default_ipv4.alias }}"
|
||||
parent: "{{ ansible_facts.default_ipv4.alias }}"
|
||||
ipam_config:
|
||||
- subnet: 10.26.120.0/24
|
||||
- subnet: 10.26.122.0/24
|
||||
|
|
@ -252,7 +252,7 @@
|
|||
name: "{{ nname_ipam_3 }}"
|
||||
driver: "macvlan"
|
||||
driver_options:
|
||||
parent: "{{ ansible_default_ipv4.alias }}"
|
||||
parent: "{{ ansible_facts.default_ipv4.alias }}"
|
||||
ipam_config:
|
||||
- subnet: 10.26.122.0/24
|
||||
register: network
|
||||
|
|
@ -266,7 +266,7 @@
|
|||
name: "{{ nname_ipam_3 }}"
|
||||
state: absent
|
||||
|
||||
when: ansible_facts.virtualization_type != 'docker' and ansible_default_ipv4.alias is defined
|
||||
when: ansible_facts.virtualization_type != 'docker' and ansible_facts.default_ipv4.alias is defined
|
||||
|
||||
|
||||
#################### IPAM driver options ####################
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
- name: swarm
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
||||
# Driver change alongside scope is intentional - bridge doesn't appear to support anything but local, and overlay can't downgrade to local. Additionally, overlay reports as swarm for swarm OR global, so no change is reported in that case.
|
||||
# Test output indicates that the scope is altered, at least, so manual inspection will be required to verify this going forward, unless we come up with a test driver that supports multiple scopes.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
- name: swarm
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
||||
####################################################################
|
||||
## overlay #########################################################
|
||||
|
|
|
|||
|
|
@ -77,4 +77,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_network_info tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -38,4 +38,4 @@
|
|||
when: docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_node tests!"
|
||||
when: not(docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
register: output
|
||||
|
||||
- name: assert changed when create a new swarm cluster
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_node_info tests!"
|
||||
when: not(docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
register: output
|
||||
|
||||
- name: assert changed when create a new swarm cluster
|
||||
|
|
|
|||
|
|
@ -33,4 +33,4 @@
|
|||
when: docker_api_version is version('1.25', '>=') and dev_fuse_stat.stat.exists
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_plugin tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -172,4 +172,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_prune tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_py_version is version('2.1.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_secrets tests!"
|
||||
when: not(docker_py_version is version('2.1.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_py_version is version('2.1.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
||||
- name: Parameter name should be required
|
||||
community.docker.docker_secret: # noqa: args[module]
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_stack tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
||||
- name: install docker_stack python requirements
|
||||
ansible.builtin.pip:
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_stack tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
- name: Create a swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
||||
- name: Get docker_stack_info when docker is running and not stack available
|
||||
community.docker.docker_stack_info:
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_stack tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
- name: Create a swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
||||
- name: Get docker_stack_info when docker is running and not stack available
|
||||
community.docker.docker_stack_info:
|
||||
|
|
|
|||
|
|
@ -27,4 +27,4 @@
|
|||
msg: "Too old docker / docker-py version to run docker_swarm tests!"
|
||||
when:
|
||||
- not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>='))
|
||||
- (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
- (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
- name: Create a Swarm cluster (check mode)
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: output_1
|
||||
|
|
@ -48,21 +48,21 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
diff: true
|
||||
register: output_2
|
||||
|
||||
- name: Create a Swarm cluster (idempotent)
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
diff: true
|
||||
register: output_3
|
||||
|
||||
- name: Create a Swarm cluster (idempotent, check mode)
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: output_4
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
- name: Create a Swarm cluster (force re-create)
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
force: true
|
||||
diff: true
|
||||
register: output_5
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
- name: Create a Swarm cluster (force re-create, check mode)
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
force: true
|
||||
check_mode: true
|
||||
diff: true
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
register: ansible_keys
|
||||
- name: signing_ca_cert and signing_ca_key (check mode)
|
||||
community.docker.docker_swarm:
|
||||
advertise_addr: '{{ ansible_default_ipv4.address | default("127.0.0.1") }}'
|
||||
advertise_addr: '{{ ansible_facts.default_ipv4.address | default("127.0.0.1") }}'
|
||||
state: present
|
||||
signing_ca_cert: '{{ ansible_certificates.results[0].content | b64decode }}'
|
||||
signing_ca_key: '{{ ansible_keys.results[0].content | b64decode }}'
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
ignore_errors: true
|
||||
- name: signing_ca_cert and signing_ca_key
|
||||
community.docker.docker_swarm:
|
||||
advertise_addr: '{{ ansible_default_ipv4.address | default("127.0.0.1") }}'
|
||||
advertise_addr: '{{ ansible_facts.default_ipv4.address | default("127.0.0.1") }}'
|
||||
state: present
|
||||
signing_ca_cert: '{{ ansible_certificates.results[0].content | b64decode }}'
|
||||
signing_ca_key: '{{ ansible_keys.results[0].content | b64decode }}'
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
name: default
|
||||
diff: true
|
||||
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
community.docker.docker_swarm:
|
||||
state: present
|
||||
force: true
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
autolock_managers: true
|
||||
diff: true
|
||||
register: output_7
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_swarm_info tests!"
|
||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
register: output
|
||||
|
||||
- name: assert changed when create a new swarm cluster
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
- name: Update swarm cluster to be locked
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
autolock_managers: true
|
||||
register: autolock_managers_update_output
|
||||
ignore_errors: true
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
||||
- ansible.builtin.include_tasks: run-test.yml
|
||||
with_fileglob:
|
||||
|
|
@ -82,4 +82,4 @@
|
|||
when: docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_swarm_service tests!"
|
||||
when: not(docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
when: docker_py_version is version('2.0.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_swarm_service_info tests!"
|
||||
when: not(docker_py_version is version('2.0.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_py_version is version('2.0.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
register: output
|
||||
|
||||
- name: Create services
|
||||
|
|
@ -82,4 +82,4 @@
|
|||
when: docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_swarm_service_info tests!"
|
||||
when: not(docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -33,4 +33,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_volume tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -74,4 +74,4 @@
|
|||
when: docker_api_version is version('1.25', '>=')
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker / docker-py version to run docker_volume_info tests!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@
|
|||
- name: Create a Swarm cluster
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||
advertise_addr: "{{ ansible_facts.default_ipv4.address | default('127.0.0.1') }}"
|
||||
|
|
|
|||
|
|
@ -9,38 +9,32 @@
|
|||
|
||||
- name: Install pre-reqs
|
||||
ansible.builtin.apt:
|
||||
name: '{{ docker_prereq_packages }}'
|
||||
name: '{{ docker_prereq_packages + ["python3-debian"] }}'
|
||||
state: present
|
||||
update_cache: true
|
||||
notify: cleanup docker
|
||||
|
||||
- when:
|
||||
- (ansible_facts.distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int) >= 22) or
|
||||
(ansible_facts.distribution == "Debian" and (ansible_facts.distribution_major_version | int) >= 12)
|
||||
name: Add Docker repo on Ubuntu 22+ or Debian 12+
|
||||
block:
|
||||
- name: Add gpg key
|
||||
ansible.builtin.get_url:
|
||||
url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
|
||||
dest: /etc/apt/keyrings/docker.asc
|
||||
- name: Add Docker repo on Ubuntu or Debian
|
||||
ansible.builtin.deb822_repository:
|
||||
name: docker
|
||||
types: deb
|
||||
architectures:
|
||||
- >-
|
||||
{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64' }}
|
||||
signed_by: "https://download.docker.com/linux/{{ ansible_facts.distribution | lower }}/gpg"
|
||||
uris:
|
||||
- https://download.docker.com/linux/{{ ansible_facts.distribution | lower }}
|
||||
suites:
|
||||
- "{{ ansible_facts.distribution_release }}"
|
||||
components:
|
||||
- stable
|
||||
state: present
|
||||
register: apt_repo
|
||||
|
||||
- name: Add Docker repo
|
||||
ansible.builtin.apt_repository:
|
||||
repo: deb [arch={{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
|
||||
state: present
|
||||
|
||||
- when:
|
||||
- (ansible_facts.distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int) < 22) or
|
||||
(ansible_facts.distribution == "Debian" and (ansible_facts.distribution_major_version | int) < 12)
|
||||
name: Add Docker repo on Ubuntu 20 or before, or Debian 11 or before
|
||||
block:
|
||||
- name: Add gpg key
|
||||
ansible.builtin.shell: curl -fsSL https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg >key && apt-key add key # noqa: command-instead-of-module
|
||||
|
||||
- name: Add Docker repo
|
||||
ansible.builtin.apt_repository:
|
||||
repo: deb [arch={{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
|
||||
state: present
|
||||
- name: Update apt cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
when: apt_repo is changed
|
||||
|
||||
- block:
|
||||
- name: Prevent service restart
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@
|
|||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: started
|
||||
ignore_errors: "{{ ansible_virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
ignore_errors: "{{ ansible_facts.virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
when: needs_docker_daemon
|
||||
|
|
|
|||
|
|
@ -42,5 +42,5 @@
|
|||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: started
|
||||
ignore_errors: "{{ ansible_virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
ignore_errors: "{{ ansible_facts.virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
when: needs_docker_daemon
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@
|
|||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: started
|
||||
ignore_errors: "{{ ansible_virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
ignore_errors: "{{ ansible_facts.virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
when: needs_docker_daemon
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@
|
|||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: started
|
||||
ignore_errors: "{{ ansible_virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
ignore_errors: "{{ ansible_facts.virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
when: needs_docker_daemon
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
block:
|
||||
- name: Determine whether Docker Daemon needs to be installed
|
||||
ansible.builtin.set_fact:
|
||||
needs_docker_daemon: '{{ not ansible_module_running_in_container }}'
|
||||
needs_docker_daemon: '{{ not ansible_facts.module_running_in_container }}'
|
||||
|
||||
- name: Print information
|
||||
ansible.builtin.debug:
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: started
|
||||
when: not ansible_module_running_in_container
|
||||
when: not ansible_facts.module_running_in_container
|
||||
|
||||
- name: Set marker that Docker was already set up
|
||||
ansible.builtin.file:
|
||||
|
|
@ -70,6 +70,26 @@
|
|||
state: touch
|
||||
when: docker_skip_cleanup
|
||||
|
||||
- name: Retrieve more information (0/4)
|
||||
ansible.builtin.command:
|
||||
cmd: sh -c export
|
||||
|
||||
- name: Retrieve more information (1/4)
|
||||
ansible.builtin.command:
|
||||
cmd: docker version
|
||||
|
||||
- name: Retrieve more information (2/4)
|
||||
ansible.builtin.command:
|
||||
cmd: docker info
|
||||
|
||||
- name: Retrieve more information (3/4)
|
||||
ansible.builtin.command:
|
||||
cmd: docker context ls
|
||||
|
||||
- name: Retrieve more information (4/4)
|
||||
ansible.builtin.command:
|
||||
cmd: which docker
|
||||
|
||||
# Detect docker API version
|
||||
- name: Check Docker API version
|
||||
ansible.builtin.command: "docker version -f {% raw %}'{{(index .Server.Components 0).Details.ApiVersion}}'{% endraw %}"
|
||||
|
|
|
|||
|
|
@ -63,4 +63,8 @@
|
|||
{{ docker_cli_plugins_stdout.stdout | from_json | selectattr('Name', 'eq', 'compose') | map(attribute='Version') | first | default('0.0') | regex_replace('^v', '') }}
|
||||
|
||||
- ansible.builtin.debug:
|
||||
msg: "Has Docker compoes plugin: {{ docker_has_compose }}; Docker compose plugin version: {{ docker_compose_version }}"
|
||||
msg: "Has Docker compose plugin: {{ docker_has_compose }}; Docker compose plugin version: {{ docker_compose_version }}"
|
||||
|
||||
- name: Retrieve more information
|
||||
ansible.builtin.command:
|
||||
cmd: docker version
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@
|
|||
- ansible.builtin.set_fact:
|
||||
has_docker_compose: false
|
||||
|
||||
- when: ansible_facts.distribution ~ ansible_facts.distribution_major_version not in ['CentOS6', 'RedHat6'] and ansible_python_version is version('3.7', '>=')
|
||||
- when: ansible_facts.distribution ~ ansible_facts.distribution_major_version not in ['CentOS6', 'RedHat6'] and ansible_facts.python_version is version('3.7', '>=')
|
||||
ansible.builtin.include_tasks:
|
||||
file: setup.yml
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
- name: Inspect current container
|
||||
community.docker.docker_container_info:
|
||||
name: "{{ ansible_module_container_id }}"
|
||||
name: "{{ ansible_facts.module_container_id }}"
|
||||
register: current_container_info
|
||||
when: ansible_module_running_in_container
|
||||
when: ansible_facts.module_running_in_container
|
||||
|
||||
- name: Determine network name
|
||||
ansible.builtin.set_fact:
|
||||
current_container_network_ip: "{{ (current_container_info.container.NetworkSettings.Networks | dictsort)[0].0 | default('') if ansible_module_running_in_container else '' }}"
|
||||
current_container_network_ip: "{{ (current_container_info.container.NetworkSettings.Networks | dictsort)[0].0 | default('') if ansible_facts.module_running_in_container else '' }}"
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
msg: Using test registry name {{ docker_registry_container_name_registry }} and nginx frontend names {{ docker_registry_container_name_nginx }} and {{ docker_registry_container_name_nginx2 }}
|
||||
|
||||
- ansible.builtin.fail: msg="Too old docker version to set up docker registry!"
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||
when: not(docker_api_version is version('1.25', '>=')) and (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int > 6)
|
||||
|
||||
- when: docker_api_version is version('1.25', '>=')
|
||||
block:
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
}}
|
||||
|
||||
- name: Check docker-py version
|
||||
ansible.builtin.command: "{{ ansible_python.executable }} -c 'import docker; print(docker.__version__)'"
|
||||
ansible.builtin.command: "{{ ansible_facts.python.executable }} -c 'import docker; print(docker.__version__)'"
|
||||
register: docker_py_version_stdout
|
||||
ignore_errors: true
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
- name: Install EPEL
|
||||
ansible.builtin.dnf:
|
||||
name: https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/setup_epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
|
||||
name: https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/setup_epel/epel-release-latest-{{ ansible_facts.distribution_major_version }}.noarch.rpm
|
||||
disable_gpg_check: true
|
||||
when: ansible_facts.distribution in ['RedHat', 'CentOS']
|
||||
|
|
|
|||
|
|
@ -9,20 +9,20 @@
|
|||
####################################################################
|
||||
|
||||
- name: Include OS-specific variables
|
||||
ansible.builtin.include_vars: '{{ ansible_os_family }}.yml'
|
||||
when: not ansible_os_family == "Darwin"
|
||||
ansible.builtin.include_vars: '{{ ansible_facts.os_family }}.yml'
|
||||
when: not ansible_facts.os_family == "Darwin"
|
||||
|
||||
- name: Install cryptography (Python 3)
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: '{{ cryptography_package_name_python3 }}'
|
||||
when: ansible_os_family != 'Darwin' and ansible_python_version is version('3.0', '>=')
|
||||
when: ansible_facts.os_family != 'Darwin' and ansible_facts.python_version is version('3.0', '>=')
|
||||
|
||||
- name: Install cryptography (Python 2)
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: '{{ cryptography_package_name }}'
|
||||
when: ansible_os_family != 'Darwin' and ansible_python_version is version('3.0', '<')
|
||||
when: ansible_facts.os_family != 'Darwin' and ansible_facts.python_version is version('3.0', '<')
|
||||
|
||||
- name: Install cryptography (Darwin, and potentially upgrade for other OSes)
|
||||
become: true
|
||||
|
|
@ -31,5 +31,5 @@
|
|||
extra_args: "-c {{ remote_constraints }}"
|
||||
|
||||
- name: Register cryptography version
|
||||
ansible.builtin.command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
|
||||
ansible.builtin.command: "{{ ansible_facts.python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
|
||||
register: cryptography_version
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
name: python-paramiko
|
||||
become: true
|
||||
when:
|
||||
- ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7
|
||||
- ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version|int <= 7
|
||||
|
||||
- name: Install paramiko
|
||||
ansible.builtin.pip:
|
||||
|
|
|
|||
|
|
@ -12,20 +12,20 @@
|
|||
pkg_mgr: community.general.pkgng
|
||||
ansible_pkg_mgr: community.general.pkgng
|
||||
cacheable: true
|
||||
when: ansible_os_family == "FreeBSD"
|
||||
when: ansible_facts.os_family == "FreeBSD"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
pkg_mgr: community.general.zypper
|
||||
ansible_pkg_mgr: community.general.zypper
|
||||
cacheable: true
|
||||
when: ansible_os_family == "Suse"
|
||||
when: ansible_facts.os_family == "Suse"
|
||||
|
||||
- ansible.builtin.shell:
|
||||
# noqa: command-instead-of-module
|
||||
cmd: |
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/*.repo
|
||||
sed -i 's%#baseurl=http://mirror.centos.org/%baseurl=https://vault.centos.org/%g' /etc/yum.repos.d/*.repo
|
||||
when: ansible_distribution in 'CentOS' and ansible_distribution_major_version == '7'
|
||||
when: ansible_facts.distribution in 'CentOS' and ansible_facts.distribution_major_version == '7'
|
||||
|
||||
- ansible.builtin.shell:
|
||||
# noqa: command-instead-of-module
|
||||
|
|
@ -33,4 +33,4 @@
|
|||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*.repo
|
||||
sed -i 's%#baseurl=http://mirror.centos.org/$contentdir/$releasever/%baseurl=https://vault.centos.org/8.4.2105/%g' /etc/yum.repos.d/CentOS-Linux-*.repo
|
||||
ignore_errors: true # This fails for CentOS Stream 8
|
||||
when: ansible_distribution in 'CentOS' and ansible_distribution_major_version == '8'
|
||||
when: ansible_facts.distribution in 'CentOS' and ansible_facts.distribution_major_version == '8'
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
ansible.builtin.command: id -u
|
||||
register: podman_user_id
|
||||
|
||||
- when: not podman_setup_marker.stat.exists and not ansible_module_running_in_container
|
||||
- when: not podman_setup_marker.stat.exists and not ansible_facts.module_running_in_container
|
||||
block:
|
||||
- name: Print information
|
||||
ansible.builtin.debug:
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
ansible.builtin.systemd_service:
|
||||
name: "{{ podman_socket_service }}"
|
||||
state: started
|
||||
scope: "{{ 'global' if podman_user_id.stdout == '0' and ansible_facts.os_family == 'RedHat' and (ansible_facts.distribution_major_version | int < 10) else 'user' }}"
|
||||
scope: "{{ 'global' if podman_user_id.stdout == '0' and ansible_facts.os_family == 'RedHat' and (ansible_facts.distribution_version is version('9.8', '<')) else 'user' }}"
|
||||
environment:
|
||||
XDG_RUNTIME_DIR: "{{ '/run' if podman_user_id.stdout == '0' else ('/run/user/' ~ podman_user_id.stdout) }}"
|
||||
|
||||
|
|
@ -67,13 +67,13 @@
|
|||
state: touch
|
||||
when: podman_skip_cleanup
|
||||
|
||||
- when: not has_podman or ansible_module_running_in_container
|
||||
- when: not has_podman or ansible_facts.module_running_in_container
|
||||
block:
|
||||
- ansible.builtin.set_fact:
|
||||
podman_cli_version: "0.0"
|
||||
podman_socket: "not available"
|
||||
|
||||
- when: has_podman and not ansible_module_running_in_container
|
||||
- when: has_podman and not ansible_facts.module_running_in_container
|
||||
block:
|
||||
- name: Check Podman CLI version
|
||||
ansible.builtin.command: "podman version -f {% raw %}'{{.Client.Version}}'{% endraw %}"
|
||||
|
|
|
|||
|
|
@ -7,4 +7,3 @@
|
|||
ansible.builtin.file:
|
||||
path: "{{ remote_tmp_dir }}"
|
||||
state: absent
|
||||
no_log: true
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
- name: make sure we have the ansible_os_family and ansible_distribution_version facts
|
||||
- name: make sure we have the ansible_facts.os_family and ansible_facts.distribution_version facts
|
||||
ansible.builtin.setup:
|
||||
gather_subset: distribution
|
||||
when: ansible_facts == {}
|
||||
|
|
@ -16,5 +16,5 @@
|
|||
- ansible.builtin.include_tasks: "{{ lookup('first_found', files) }}"
|
||||
vars:
|
||||
files:
|
||||
- "{{ ansible_os_family | lower }}.yml"
|
||||
- "{{ ansible_facts.os_family | lower }}.yml"
|
||||
- "default.yml"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
# Copyright (c) 2026, Felix Fontein <felix@fontein.de>
|
||||
# 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
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping, Sequence
|
||||
|
||||
|
||||
def _normalize_image_impl(data):
|
||||
identity = data.get("Identity")
|
||||
if not isinstance(identity, Mapping):
|
||||
return data
|
||||
pull = identity.get("Pull")
|
||||
if not isinstance(pull, Sequence):
|
||||
return data
|
||||
new_identity = dict(identity)
|
||||
new_identity["Pull"] = sorted(identity["Pull"], key=lambda entry: entry.get("Repository") or "")
|
||||
new_data = dict(data)
|
||||
new_data["Identity"] = new_identity
|
||||
return new_data
|
||||
|
||||
|
||||
def _process(data, place_parts, place_index, processor):
|
||||
if place_index == len(place_parts):
|
||||
return processor(data)
|
||||
new_data = dict(data)
|
||||
new_data[place_parts[place_index]] = _process(data[place_parts[place_index]], place_parts, place_index + 1, processor)
|
||||
return new_data
|
||||
|
||||
|
||||
def normalize_image(data, *places):
|
||||
if not places:
|
||||
return _normalize_image_impl(data)
|
||||
for place in places:
|
||||
data = _process(data, place.split("."), 0, _normalize_image_impl)
|
||||
return data
|
||||
|
||||
|
||||
class FilterModule:
|
||||
"""Utilities for community.docker tests."""
|
||||
|
||||
def filters(self):
|
||||
return {
|
||||
'internal__normalize_image': normalize_image,
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
# 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
|
||||
Loading…
Reference in a new issue