community.docker.docker_stack_task_info module – Return information of the tasks on a docker stack

Note

This module is part of the community.docker collection (version 3.4.3).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.docker.

To use it in a playbook, specify: community.docker.docker_stack_task_info.

Synopsis

  • Retrieve information on docker stacks tasks using the docker stack command on the target node (see examples).

Parameters

Parameter

Comments

name

string / required

Stack name.

Attributes

Attribute

Support

Description

check_mode

Support: full

This action does not modify state.

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: N/A

This action does not modify state.

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Examples

- name: Shows stack info
  community.docker.docker_stack_task_info:
    name: test_stack
  register: result

- name: Show results
  ansible.builtin.debug:
    var: result.results

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

results

list / elements=dictionary

List of dictionaries containing the list of tasks associated to a stack name.

Returned: always

Sample: "[{\"CurrentState\":\"Running\",\"DesiredState\":\"Running\",\"Error\":\"\",\"ID\":\"7wqv6m02ugkw\",\"Image\":\"busybox\",\"Name\":\"test_stack.1\",\"Node\":\"swarm\",\"Ports\":\"\"}]\n"

Authors

  • Jose Angel Munoz (@imjoseangel)