Ansible modules normally return a data structure that can be registered into a variable, or seen directly when output by the ansible
program. Each module can optionally document its own unique return values (visible through ansible-doc and https://docs.ansible.com).
This document covers return values common to all modules.
Note
Some of these keys might be set by Ansible itself once it processes the module’s return information.
For those modules that implement backup=no|yes
when manipulating files, a path to the backup file created.
A boolean indicating if the task had to make changes.
A boolean that indicates if the task was failed or not.
Information on how the module was invoked.
A string with a generic message relayed to the user.
Some modules execute command line utilities or are geared for executing commands directly (raw, shell, command, etc), this field contains ‘return code’ of these utilities.
If this key exists, it indicates that a loop was present for the task and that it contains a list of the normal module ‘result’ per item.
A boolean that indicates if the task was skipped or not
Some modules execute command line utilities or are geared for executing commands directly (raw, shell, command, etc), this field contains the error output of these utilities.
When stderr
is returned we also always provide this field which is a list of strings, one item per line from the original.
Some modules execute command line utilities or are geared for executing commands directly (raw, shell, command, etc). This field contains the normal output of these utilities.
When stdout
is returned, Ansible always provides a list of strings, each containing one item per line from the original output.
These keys can be added by modules but will be removed from registered variables; they are ‘consumed’ by Ansible itself.
This key should contain a dictionary which will be appended to the facts assigned to the host. These will be directly accessible and don’t require using a registered variable.
This key can contain traceback information caused by an exception in a module. It will only be displayed on high verbosity (-vvv).
This key contains a list of strings that will be presented to the user.
This key contains a list of dictionaries that will be presented to the user. Keys of the dictionaries are msg
and version
, values are string, value for the version
key can be an empty string.
See also
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/common_return_values.html