community.docker.docker_stack_info module – Return information on a docker stack

Note

This module is part of the community.docker collection (version 2.7.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_info.

Synopsis

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

Examples

- name: Shows stack info
  community.docker.docker_stack_info:
  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 stacks or tasks associated to a stack name.

Returned: always

Sample: [{"name": "grafana", "namespace": "default", "orchestrator": "Kubernetes", "services": "2"}]

Authors

  • Jose Angel Munoz (@imjoseangel)