docker_image_info: improve docs (#60622)

* Improve return value documentation.

* Improve example.

* Fix typo.

* Update lib/ansible/modules/cloud/docker/docker_image_info.py

Co-Authored-By: Alicia Cozine <879121+acozine@users.noreply.github.com>

* Update lib/ansible/modules/cloud/docker/docker_image_info.py

Co-Authored-By: Alicia Cozine <879121+acozine@users.noreply.github.com>
This commit is contained in:
Felix Fontein 2019-08-19 09:21:50 +02:00 committed by ansibot
parent 555b8413a1
commit 7a9e865a23

View file

@ -22,6 +22,11 @@ version_added: "2.1.0"
description: description:
- Provide one or more image names, and the module will inspect each, returning an array of inspection results. - Provide one or more image names, and the module will inspect each, returning an array of inspection results.
- If an image does not exist locally, it will not appear in the results. If you want to check whether an image exists
locally, you can call the module with the image name, then check whether the result list is empty (image does not
exist) or has one element (the image exists locally).
- The module will not attempt to pull images from registries. Use M(docker_image) with I(source) set to C(pull)
to ensure an image is pulled.
notes: notes:
- This module was called C(docker_image_facts) before Ansible 2.8. The usage did not change. - This module was called C(docker_image_facts) before Ansible 2.8. The usage did not change.
@ -49,7 +54,6 @@ author:
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: Inspect a single image - name: Inspect a single image
docker_image_info: docker_image_info:
name: pacur/centos-7 name: pacur/centos-7
@ -59,13 +63,21 @@ EXAMPLES = '''
name: name:
- pacur/centos-7 - pacur/centos-7
- sinatra - sinatra
register: result
- name: Make sure that both images pacur/centos-7 and sinatra exist locally
assert:
that:
- result.images | length == 2
''' '''
RETURN = ''' RETURN = '''
images: images:
description: Facts for the selected images. description:
- Inspection results for the selected images.
- The list only contains inspection results of images existing locally.
returned: always returned: always
type: dict type: list
sample: [ sample: [
{ {
"Architecture": "amd64", "Architecture": "amd64",