Ansible modules normally return a data structure that can be registered into a variable, or seen directly when using
Ansible modules normally return a data structure that can be registered into a variable, or seen directly when using
the `ansible` program as output. Here we document the values common to all modules, each module can optionally document
the `ansible` program as output. Here we document the values common to all modules, each module can optionally document
its own unique returns. If these docs exist they will be visible through ansible-doc and https://docs.ansible.com.
its own unique returns. If these docs exist they will be visible through ansible-doc and https://docs.ansible.com.
Some of these keys might be set by Ansible itself once it processes the module's return information.
.._facts:
Facts
changed
`````
```````
A boolean that indicates if the task had to effect changes or not.
Some modules return 'facts' to ansible (i.e setup), this is done through a 'ansible_facts' key and anything inside
failed
will automatically be available for the current host directly as a variable and there is no need to
``````
register this data.
A boolean that indicates if the task was failed or not.
invocation
``````````
Information on how the module was invoked.
msg
```
A string with a generic message relayed to user.
rc
``
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.
results
```````
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.
skipped
```````
A boolean that indicates if the task was skipped or not
stderr
``````
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.
.._status:
stderr_lines
````````````
When c(stderr) is returned we also always provide this field which is a list of strings, one item per line from the original.
Status
stdout
``````
``````
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.
Every module must return a status, saying if the module was successful, if anything changed or not. Ansible itself
stdout_lines
will return a status if it skips the module due to a user condition (when: ) or running in check mode when the module
````````````
does not support it.
When c(stdout) is returned we also always provide this field which is a list of strings, one item per line from the original.
Internal use
============
These keys can be added by modules but will be removed from registered variables, they are 'consumed' by Ansible itself.
.._other:
ansible_facts
`````````````
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.
Other common returns
exception
````````````````````
`````````
This key can contain traceback information caused by an exception in a module, it will only be displayed on high verbosity (-vvv).
It is common on failure or success to return a 'msg' that either explains the failure or makes a note about the execution.
warnings
Some modules, specifically those that execute shell or commands directly, will return stdout and stderr, if ansible sees
````````
a stdout in the results it will append a stdout_lines which is just a list or the lines in stdout.
This key contains a list of strings that will be presented to the user.