mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
docker: rename docker_*_facts -> docker_*_info (#54124)
* Rename docker_*_facts -> docker_*_info. * Add changelog. * Update scenario guide.
This commit is contained in:
parent
9c77509cbc
commit
8d62794f91
40 changed files with 114 additions and 106 deletions
2
changelogs/fragments/54124-docker_image-facts-info.yml
Normal file
2
changelogs/fragments/54124-docker_image-facts-info.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- The ``docker_image_facts`` module has been renamed to ``docker_image_info``.
|
|
@ -14,8 +14,8 @@ Ansible offers the following modules for orchestrating Docker containers:
|
|||
docker_image
|
||||
Provides full control over images, including: build, pull, push, tag and remove.
|
||||
|
||||
docker_image_facts
|
||||
Inspects one or more images in the Docker host's image cache, providing the information as facts for making
|
||||
docker_image_info
|
||||
Inspects one or more images in the Docker host's image cache, providing the information for making
|
||||
decision or assertions in a playbook.
|
||||
|
||||
docker_login
|
||||
|
|
1
lib/ansible/modules/cloud/docker/_docker_image_facts.py
Symbolic link
1
lib/ansible/modules/cloud/docker/_docker_image_facts.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
docker_image_info.py
|
|
@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: docker_container_facts
|
||||
module: docker_container_info
|
||||
|
||||
short_description: Retrieves facts about docker container
|
||||
|
||||
|
@ -46,7 +46,7 @@ requirements:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get infos on container
|
||||
docker_container_facts:
|
||||
docker_container_info:
|
||||
name: mydata
|
||||
register: result
|
||||
|
|
@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: docker_host_facts
|
||||
module: docker_host_info
|
||||
|
||||
short_description: Retrieves facts about docker host and lists of objects of the services.
|
||||
|
||||
|
@ -87,7 +87,7 @@ options:
|
|||
- When set to C(yes) and I(networks), I(volumes), I(images), I(containers) or I(disk_usage) is set to C(yes)
|
||||
then output will contain verbose information about objects matching the full output of API method.
|
||||
For details see the documentation of your version of Docker API at L(https://docs.docker.com/engine/api/).
|
||||
- The verbose output in this module contains only subset of information returned by I(_facts) module
|
||||
- The verbose output in this module contains only subset of information returned by I(_info) module
|
||||
for each type of the objects.
|
||||
type: bool
|
||||
default: no
|
||||
|
@ -105,29 +105,29 @@ requirements:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get info on docker host
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
register: result
|
||||
|
||||
- name: Get info on docker host and list images
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
images: yes
|
||||
register: result
|
||||
|
||||
- name: Get info on docker host and list images matching the filter
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
images: yes
|
||||
images_filters:
|
||||
label: "mylabel"
|
||||
register: result
|
||||
|
||||
- name: Get info on docker host and verbose list images
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
images: yes
|
||||
verbose_output: yes
|
||||
register: result
|
||||
|
||||
- name: Get info on docker host and used disk space
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
disk_usage: yes
|
||||
register: result
|
||||
|
|
@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: docker_image_facts
|
||||
module: docker_image_info
|
||||
|
||||
short_description: Inspect docker images
|
||||
|
||||
|
@ -23,6 +23,9 @@ version_added: "2.1.0"
|
|||
description:
|
||||
- Provide one or more image names, and the module will inspect each, returning an array of inspection results.
|
||||
|
||||
notes:
|
||||
- This module was called C(docker_image_facts) before Ansible 2.8. The usage did not change.
|
||||
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
@ -48,11 +51,11 @@ author:
|
|||
EXAMPLES = '''
|
||||
|
||||
- name: Inspect a single image
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name: pacur/centos-7
|
||||
|
||||
- name: Inspect multiple images
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name:
|
||||
- pacur/centos-7
|
||||
- sinatra
|
||||
|
@ -228,6 +231,8 @@ def main():
|
|||
supports_check_mode=True,
|
||||
min_docker_api_version='1.20',
|
||||
)
|
||||
if client.module._name == 'docker_image_facts':
|
||||
client.module.deprecate("The 'docker_image_facts' module has been renamed to 'docker_image_info'", version='2.12')
|
||||
|
||||
results = dict(
|
||||
changed=False,
|
|
@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: docker_network_facts
|
||||
module: docker_network_info
|
||||
|
||||
short_description: Retrieves facts about docker network
|
||||
|
||||
|
@ -46,7 +46,7 @@ requirements:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get infos on network
|
||||
docker_network_facts:
|
||||
docker_network_info:
|
||||
name: mydata
|
||||
register: result
|
||||
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: docker_node_facts
|
||||
module: docker_node_info
|
||||
|
||||
short_description: Retrieves facts about docker swarm node from Swarm Manager
|
||||
|
||||
|
@ -54,23 +54,23 @@ requirements:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get info on all nodes
|
||||
docker_node_facts:
|
||||
docker_node_info:
|
||||
register: result
|
||||
|
||||
- name: Get info on node
|
||||
docker_node_facts:
|
||||
docker_node_info:
|
||||
name: mynode
|
||||
register: result
|
||||
|
||||
- name: Get info on list of nodes
|
||||
docker_node_facts:
|
||||
docker_node_info:
|
||||
name:
|
||||
- mynode1
|
||||
- mynode2
|
||||
register: result
|
||||
|
||||
- name: Get info on host if it is Swarm Manager
|
||||
docker_node_facts:
|
||||
docker_node_info:
|
||||
self: true
|
||||
register: result
|
||||
'''
|
|
@ -412,7 +412,7 @@ class SwarmManager(DockerBaseClass):
|
|||
|
||||
if self.state == 'inspect':
|
||||
self.client.module.deprecate(
|
||||
"The 'inspect' state is deprecated, please use 'docker_swarm_facts' to inspect swarm cluster",
|
||||
"The 'inspect' state is deprecated, please use 'docker_swarm_info' to inspect swarm cluster",
|
||||
version='2.12')
|
||||
|
||||
choice_map.get(self.state)()
|
||||
|
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: docker_swarm_facts
|
||||
module: docker_swarm_info
|
||||
|
||||
short_description: Retrieves facts about Docker Swarm cluster.
|
||||
|
||||
|
@ -73,7 +73,7 @@ options:
|
|||
- When set to C(yes) and I(nodes), I(services) or I(tasks) is set to C(yes)
|
||||
then output will contain verbose information about objects matching the full output of API method.
|
||||
For details see the documentation of your version of Docker API at U(https://docs.docker.com/engine/api/).
|
||||
- The verbose output in this module contains only subset of information returned by I(_facts) module
|
||||
- The verbose output in this module contains only subset of information returned by I(_info) module
|
||||
for each type of the objects.
|
||||
type: bool
|
||||
default: no
|
||||
|
@ -88,7 +88,7 @@ requirements:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get info on Docker Swarm
|
||||
docker_swarm_facts:
|
||||
docker_swarm_info:
|
||||
ignore_errors: yes
|
||||
register: result
|
||||
|
||||
|
@ -102,18 +102,18 @@ EXAMPLES = '''
|
|||
- block:
|
||||
|
||||
- name: Get info on Docker Swarm and list of registered nodes
|
||||
docker_swarm_facts:
|
||||
docker_swarm_info:
|
||||
nodes: yes
|
||||
register: result
|
||||
|
||||
- name: Get info on Docker Swarm and extended list of registered nodes
|
||||
docker_swarm_facts:
|
||||
docker_swarm_info:
|
||||
nodes: yes
|
||||
verbose_output: yes
|
||||
register: result
|
||||
|
||||
- name: Get info on Docker Swarm and filtered list of registered nodes
|
||||
docker_swarm_facts:
|
||||
docker_swarm_info:
|
||||
nodes: yes
|
||||
nodes_filter:
|
||||
name: mynode
|
|
@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
|
||||
DOCUMENTATION = u'''
|
||||
module: docker_volume_facts
|
||||
module: docker_volume_info
|
||||
version_added: "2.8"
|
||||
short_description: Retrieve facts about Docker volumes
|
||||
description:
|
||||
|
@ -42,7 +42,7 @@ requirements:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get infos on volume
|
||||
docker_volume_facts:
|
||||
docker_volume_info:
|
||||
name: mydata
|
||||
register: result
|
||||
|
|
@ -17,23 +17,23 @@
|
|||
loop_var: image
|
||||
|
||||
- name: Get image ID of hello-world and alpine images
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name:
|
||||
- "hello-world:latest"
|
||||
- "alpine:3.8"
|
||||
register: image_facts
|
||||
register: image_info
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- image_facts.images | length == 2
|
||||
- image_info.images | length == 2
|
||||
|
||||
- name: Print image IDs
|
||||
debug:
|
||||
msg: "hello-world: {{ image_facts.images[0].Id }}; alpine: {{ image_facts.images[1].Id }}"
|
||||
msg: "hello-world: {{ image_info.images[0].Id }}; alpine: {{ image_info.images[1].Id }}"
|
||||
|
||||
- name: Create container with hello-world image via ID
|
||||
docker_container:
|
||||
image: "{{ image_facts.images[0].Id }}"
|
||||
image: "{{ image_info.images[0].Id }}"
|
||||
name: "{{ cname }}"
|
||||
state: present
|
||||
force_kill: yes
|
||||
|
@ -41,7 +41,7 @@
|
|||
|
||||
- name: Create container with hello-world image via ID (idempotent)
|
||||
docker_container:
|
||||
image: "{{ image_facts.images[0].Id }}"
|
||||
image: "{{ image_info.images[0].Id }}"
|
||||
name: "{{ cname }}"
|
||||
state: present
|
||||
force_kill: yes
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
- name: Create container with alpine image via ID
|
||||
docker_container:
|
||||
image: "{{ image_facts.images[1].Id }}"
|
||||
image: "{{ image_info.images[1].Id }}"
|
||||
name: "{{ cname }}"
|
||||
state: present
|
||||
force_kill: yes
|
||||
|
@ -57,7 +57,7 @@
|
|||
|
||||
- name: Create container with alpine image via ID (idempotent)
|
||||
docker_container:
|
||||
image: "{{ image_facts.images[1].Id }}"
|
||||
image: "{{ image_info.images[1].Id }}"
|
||||
name: "{{ cname }}"
|
||||
state: present
|
||||
force_kill: yes
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
force_kill: yes
|
||||
|
||||
- name: Inspect a non-present container
|
||||
docker_container_facts:
|
||||
docker_container_info:
|
||||
name: "{{ cname }}"
|
||||
register: result
|
||||
|
||||
|
@ -31,10 +31,10 @@
|
|||
force_kill: yes
|
||||
|
||||
- name: Inspect a present container
|
||||
docker_container_facts:
|
||||
docker_container_info:
|
||||
name: "{{ cname }}"
|
||||
register: result
|
||||
- name: Dump docker_container_facts result
|
||||
- name: Dump docker_container_info result
|
||||
debug: var=result
|
||||
|
||||
- name: "Comparison: use 'docker inspect'"
|
||||
|
@ -60,5 +60,5 @@
|
|||
|
||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
||||
|
||||
- fail: msg="Too old docker / docker-py version to run docker_container_facts tests!"
|
||||
- fail: msg="Too old docker / docker-py version to run docker_container_info tests!"
|
||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
|
@ -1,5 +1,5 @@
|
|||
- include_tasks: test_host_facts.yml
|
||||
- include_tasks: test_host_info.yml
|
||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.21', '>=')
|
||||
|
||||
- fail: msg="Too old docker / docker-py version to run docker_host_facts tests!"
|
||||
- fail: msg="Too old docker / docker-py version to run docker_host_info tests!"
|
||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.21', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
- block:
|
||||
- name: Get info on Docker host
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
register: output
|
||||
|
||||
- name: assert reading docker host facts when docker is running
|
||||
|
@ -48,7 +48,7 @@
|
|||
- volume_output is changed
|
||||
|
||||
- name: Get info on Docker host and list containers
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
containers: yes
|
||||
register: output
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
|||
- 'output.containers[0].ImageID is not defined'
|
||||
|
||||
- name: Get info on Docker host and list containers with verbose output
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
containers: yes
|
||||
verbose_output: yes
|
||||
register: output
|
||||
|
@ -81,7 +81,7 @@
|
|||
- 'output.containers[0].ImageID is string'
|
||||
|
||||
- name: Get info on Docker host and list images
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
images: yes
|
||||
register: output
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
|||
- 'output.disk_usage is not defined'
|
||||
|
||||
- name: Get info on Docker host and list images with verbose output
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
images: yes
|
||||
verbose_output: yes
|
||||
register: output
|
||||
|
@ -114,7 +114,7 @@
|
|||
- 'output.disk_usage is not defined'
|
||||
|
||||
- name: Get info on Docker host and list networks
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
networks: yes
|
||||
register: output
|
||||
|
||||
|
@ -130,7 +130,7 @@
|
|||
- 'output.disk_usage is not defined'
|
||||
|
||||
- name: Get info on Docker host and list networks with verbose output
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
networks: yes
|
||||
verbose_output: yes
|
||||
register: output
|
||||
|
@ -147,7 +147,7 @@
|
|||
- 'output.disk_usage is not defined'
|
||||
|
||||
- name: Get info on Docker host and list volumes
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
volumes: yes
|
||||
register: output
|
||||
|
||||
|
@ -163,7 +163,7 @@
|
|||
- 'output.disk_usage is not defined'
|
||||
|
||||
- name: Get info on Docker host and list volumes with verbose output
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
volumes: yes
|
||||
verbose_output: yes
|
||||
register: output
|
||||
|
@ -180,7 +180,7 @@
|
|||
- 'output.disk_usage is not defined'
|
||||
|
||||
- name: Get info on Docker host and get disk usage
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
disk_usage: yes
|
||||
register: output
|
||||
|
||||
|
@ -196,7 +196,7 @@
|
|||
- 'output.disk_usage.BuilderSize is not defined'
|
||||
|
||||
- name: Get info on Docker host and get disk usage with verbose output
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
disk_usage: yes
|
||||
verbose_output: yes
|
||||
register: output
|
||||
|
@ -213,7 +213,7 @@
|
|||
- 'output.disk_usage.BuilderSize is number'
|
||||
|
||||
- name: Get info on Docker host, disk usage and get all lists together
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
volumes: yes
|
||||
containers: yes
|
||||
networks: yes
|
||||
|
@ -237,7 +237,7 @@
|
|||
- 'output.disk_usage.BuilderSize is not defined'
|
||||
|
||||
- name: Get info on Docker host, disk usage and get all lists together with verbose output
|
||||
docker_host_facts:
|
||||
docker_host_info:
|
||||
volumes: yes
|
||||
containers: yes
|
||||
networks: yes
|
|
@ -115,7 +115,7 @@
|
|||
- push_3 is not changed
|
||||
|
||||
- name: Get facts of local image
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name: "{{ registry_address }}/test/hello-world:latest"
|
||||
register: facts_1
|
||||
|
||||
|
@ -126,7 +126,7 @@
|
|||
force_absent: yes
|
||||
|
||||
- name: Get facts of local image (absent)
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name: "{{ registry_address }}/test/hello-world:latest"
|
||||
register: facts_2
|
||||
|
||||
|
@ -145,7 +145,7 @@
|
|||
register: pull_2
|
||||
|
||||
- name: Get facts of local image (present)
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name: "{{ registry_address }}/test/hello-world:latest"
|
||||
register: facts_3
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@
|
|||
- repository_2 is not changed
|
||||
|
||||
- name: Get facts of image
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name: "{{ registry_address }}/test/{{ iname }}:latest"
|
||||
register: facts_1
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
state: absent
|
||||
|
||||
- name: Inspect a non-available image
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name: alpine:3.7
|
||||
register: result
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
- "alpine:3.8"
|
||||
|
||||
- name: Inspect an available image
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name: hello-world:latest
|
||||
register: result
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
- "'hello-world:latest' in result.images[0].RepoTags"
|
||||
|
||||
- name: Inspect multiple images
|
||||
docker_image_facts:
|
||||
docker_image_info:
|
||||
name:
|
||||
- "hello-world:latest"
|
||||
- "alpine:3.8"
|
||||
|
@ -50,5 +50,5 @@
|
|||
|
||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
||||
|
||||
- fail: msg="Too old docker / docker-py version to run docker_image_facts tests!"
|
||||
- fail: msg="Too old docker / docker-py version to run docker_image_info tests!"
|
||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
|
@ -11,7 +11,7 @@
|
|||
force: yes
|
||||
|
||||
- name: Inspect a non-present network
|
||||
docker_network_facts:
|
||||
docker_network_info:
|
||||
name: "{{ nname }}"
|
||||
register: result
|
||||
|
||||
|
@ -27,10 +27,10 @@
|
|||
state: present
|
||||
|
||||
- name: Inspect a present network
|
||||
docker_network_facts:
|
||||
docker_network_info:
|
||||
name: "{{ nname }}"
|
||||
register: result
|
||||
- name: Dump docker_network_facts result
|
||||
- name: Dump docker_network_info result
|
||||
debug: var=result
|
||||
|
||||
- name: "Comparison: use 'docker network inspect'"
|
||||
|
@ -56,5 +56,5 @@
|
|||
|
||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.21', '>=')
|
||||
|
||||
- fail: msg="Too old docker / docker-py version to run docker_network_facts tests!"
|
||||
- fail: msg="Too old docker / docker-py version to run docker_network_info tests!"
|
||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.21', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
|
@ -5,8 +5,8 @@
|
|||
state: absent
|
||||
force: true
|
||||
|
||||
- name: Try to get docker_node_facts when docker is not running in swarm mode
|
||||
docker_node_facts:
|
||||
- name: Try to get docker_node_info when docker is not running in swarm mode
|
||||
docker_node_info:
|
||||
ignore_errors: yes
|
||||
register: output
|
||||
|
||||
|
@ -29,8 +29,8 @@
|
|||
- 'output.swarm_facts.JoinTokens.Manager'
|
||||
- 'output.swarm_facts.JoinTokens.Worker'
|
||||
|
||||
- name: Try to get docker_node_facts when docker is running in swarm mode and as manager
|
||||
docker_node_facts:
|
||||
- name: Try to get docker_node_info when docker is running in swarm mode and as manager
|
||||
docker_node_info:
|
||||
register: output
|
||||
|
||||
- name: assert reading docker swarm node facts
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- include_tasks: test_node_facts.yml
|
||||
# Maximum of 1.24 (docker API version for docker_node_facts) and 1.25 (docker API version for docker_swarm) is 1.25
|
||||
- include_tasks: test_node_info.yml
|
||||
# Maximum of 1.24 (docker API version for docker_node_info) and 1.25 (docker API version for docker_swarm) is 1.25
|
||||
when: docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- fail: msg="Too old docker / docker-py version to run docker_node_facts tests!"
|
||||
- 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)
|
|
@ -5,8 +5,8 @@
|
|||
state: absent
|
||||
force: true
|
||||
|
||||
- name: Try to get docker_node_facts when docker is not running in swarm mode
|
||||
docker_node_facts:
|
||||
- name: Try to get docker_node_info when docker is not running in swarm mode
|
||||
docker_node_info:
|
||||
ignore_errors: yes
|
||||
register: output
|
||||
|
||||
|
@ -29,8 +29,8 @@
|
|||
- 'output.swarm_facts.JoinTokens.Manager'
|
||||
- 'output.swarm_facts.JoinTokens.Worker'
|
||||
|
||||
- name: Try to get docker_node_facts when docker is running in swarm mode and as manager
|
||||
docker_node_facts:
|
||||
- name: Try to get docker_node_info when docker is running in swarm mode and as manager
|
||||
docker_node_info:
|
||||
register: output
|
||||
|
||||
- name: assert reading docker swarm node facts
|
||||
|
@ -39,8 +39,8 @@
|
|||
- 'output.nodes | length > 0'
|
||||
- 'output.nodes[0].ID is string'
|
||||
|
||||
- name: Try to get docker_node_facts using the self parameter
|
||||
docker_node_facts:
|
||||
- name: Try to get docker_node_info using the self parameter
|
||||
docker_node_info:
|
||||
self: yes
|
||||
register: output
|
||||
|
||||
|
@ -55,8 +55,8 @@
|
|||
localnodename: "{{ output.nodes[0].Description.Hostname }}"
|
||||
|
||||
|
||||
- name: Try to get docker_node_facts using the local node name as parameter
|
||||
docker_node_facts:
|
||||
- name: Try to get docker_node_info using the local node name as parameter
|
||||
docker_node_info:
|
||||
name: "{{ localnodename }}"
|
||||
register: output
|
||||
|
||||
|
@ -70,8 +70,8 @@
|
|||
set_fact:
|
||||
randomnodename: "{{ 'node-%0x' % ((2**32) | random) }}"
|
||||
|
||||
- name: Try to get docker_node_facts using random node name as parameter
|
||||
docker_node_facts:
|
||||
- name: Try to get docker_node_info using random node name as parameter
|
||||
docker_node_info:
|
||||
name: "{{ randomnodename }}"
|
||||
register: output
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
debug: msg="{{ lookup('file', output_dir ~ '/ansible_key1.key') }}"
|
||||
- name: Cert
|
||||
debug: msg="{{ lookup('file', output_dir ~ '/ansible_key1.pem') }}"
|
||||
- docker_swarm_facts:
|
||||
- docker_swarm_info:
|
||||
register: output
|
||||
ignore_errors: yes
|
||||
- debug: var=output
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- include_tasks: test_swarm_facts.yml
|
||||
# Maximum of 1.24 (docker API version for docker_swarm_facts) and 1.25 (docker API version for docker_swarm) is 1.25
|
||||
- include_tasks: test_swarm_info.yml
|
||||
# Maximum of 1.24 (docker API version for docker_swarm_info) and 1.25 (docker API version for docker_swarm) is 1.25
|
||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||
|
||||
- fail: msg="Too old docker / docker-py version to run docker_swarm_facts tests!"
|
||||
- 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)
|
|
@ -5,8 +5,8 @@
|
|||
state: absent
|
||||
force: true
|
||||
|
||||
- name: Try to get docker_swarm_facts when docker is not running in swarm mode
|
||||
docker_swarm_facts:
|
||||
- name: Try to get docker_swarm_info when docker is not running in swarm mode
|
||||
docker_swarm_info:
|
||||
ignore_errors: yes
|
||||
register: output
|
||||
|
||||
|
@ -32,8 +32,8 @@
|
|||
- 'output.swarm_facts.JoinTokens.Manager'
|
||||
- 'output.swarm_facts.JoinTokens.Worker'
|
||||
|
||||
- name: Try to get docker_swarm_facts when docker is running in swarm mode and as manager
|
||||
docker_swarm_facts:
|
||||
- name: Try to get docker_swarm_info when docker is running in swarm mode and as manager
|
||||
docker_swarm_info:
|
||||
register: output
|
||||
|
||||
- name: assert creding docker swarm facts
|
||||
|
@ -46,8 +46,8 @@
|
|||
- 'output.docker_swarm_active == true'
|
||||
- 'output.docker_swarm_manager == true'
|
||||
|
||||
- name: Try to get docker_swarm_facts and list of nodes when docker is running in swarm mode and as manager
|
||||
docker_swarm_facts:
|
||||
- name: Try to get docker_swarm_info and list of nodes when docker is running in swarm mode and as manager
|
||||
docker_swarm_info:
|
||||
nodes: yes
|
||||
register: output
|
||||
|
||||
|
@ -67,8 +67,8 @@
|
|||
localnodename: "{{ output.nodes[0].Hostname }}"
|
||||
|
||||
|
||||
- name: Try to get docker_swarm_facts and verbose list of nodes when docker is running in swarm mode and as manager
|
||||
docker_swarm_facts:
|
||||
- name: Try to get docker_swarm_info and verbose list of nodes when docker is running in swarm mode and as manager
|
||||
docker_swarm_info:
|
||||
nodes: yes
|
||||
verbose_output: yes
|
||||
register: output
|
||||
|
@ -85,8 +85,8 @@
|
|||
- 'output.docker_swarm_active == true'
|
||||
- 'output.docker_swarm_manager == true'
|
||||
|
||||
- name: Try to get docker_swarm_facts and list of nodes with filters providing existing node name
|
||||
docker_swarm_facts:
|
||||
- name: Try to get docker_swarm_info and list of nodes with filters providing existing node name
|
||||
docker_swarm_info:
|
||||
nodes: yes
|
||||
nodes_filters:
|
||||
name: "{{ localnodename }}"
|
||||
|
@ -107,8 +107,8 @@
|
|||
set_fact:
|
||||
randomnodename: "{{ 'node-%0x' % ((2**32) | random) }}"
|
||||
|
||||
- name: Try to get docker_swarm_facts and list of nodes with filters providing non-existing random node name
|
||||
docker_swarm_facts:
|
||||
- name: Try to get docker_swarm_info and list of nodes with filters providing non-existing random node name
|
||||
docker_swarm_info:
|
||||
nodes: yes
|
||||
nodes_filters:
|
||||
name: "{{ randomnodename }}"
|
|
@ -10,7 +10,7 @@
|
|||
state: absent
|
||||
|
||||
- name: Inspect a non-present volume
|
||||
docker_volume_facts:
|
||||
docker_volume_info:
|
||||
name: "{{ cname }}"
|
||||
register: result
|
||||
|
||||
|
@ -25,10 +25,10 @@
|
|||
name: "{{ cname }}"
|
||||
|
||||
- name: Inspect a present volume
|
||||
docker_volume_facts:
|
||||
docker_volume_info:
|
||||
name: "{{ cname }}"
|
||||
register: result
|
||||
- name: Dump docker_volume_facts result
|
||||
- name: Dump docker_volume_info result
|
||||
debug: var=result
|
||||
|
||||
- name: "Comparison: use 'docker volume inspect'"
|
||||
|
@ -54,5 +54,5 @@
|
|||
# Requirements for docker_volume
|
||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.24', '>=')
|
||||
|
||||
- fail: msg="Too old docker / docker-py version to run docker_volume_facts tests!"
|
||||
- fail: msg="Too old docker / docker-py version to run docker_volume_info tests!"
|
||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.24', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
Loading…
Reference in a new issue