Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
94909bd4
Commit
94909bd4
authored
Mar 13, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added return values documentation to modules
parent
393246fd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
0 deletions
+63
-0
docsite/rst/common_return_values.rst
+47
-0
hacking/module_formatter.py
+1
-0
hacking/templates/rst.j2
+15
-0
No files found.
docsite/rst/common_return_values.rst
0 → 100644
View file @
94909bd4
Common Return Values
====================
.. contents:: Topics
Ansible modules normally return a data structure that can be registered into a variable,
or seen directly when using the `ansible` program as output.
.. _facts:
Facts
`````
Some modules return 'facts' to ansible (i.e setup), this is done through a 'ansible_facts' key and anything inside
will automatically be available for the current host directly as a variable and there is no need to
register this data.
.. _status:
Status
``````
Every module must return a status, saying if the module was successful, if anything changed or not. Ansible itself
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.
.. _other:
Other common returns
````````````````````
It is common on failure or success to return a 'msg' that either explains the failure or makes a note about the execution.
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.
.. seealso::
:doc:`modules`
Learn about available modules
`GitHub modules directory <https://github.com/ansible/ansible/tree/devel/library>`_
Browse source of core modules
`Mailing List <http://groups.google.com/group/ansible-devel>`_
Development mailing list
`irc.freenode.net <http://irc.freenode.net>`_
#ansible IRC chat channel
hacking/module_formatter.py
View file @
94909bd4
...
...
@@ -289,6 +289,7 @@ def process_module(module, options, env, template, outputname, module_map, alias
doc
[
'now_date'
]
=
datetime
.
date
.
today
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
doc
[
'ansible_version'
]
=
options
.
ansible_version
doc
[
'plainexamples'
]
=
examples
#plain text
doc
[
'returndocs'
]
=
returndocs
# here is where we build the table of contents...
...
...
hacking/templates/rst.j2
View file @
94909bd4
...
...
@@ -106,6 +106,21 @@ Examples
{% endif %}
{% endif %}
{% if returndocs %}
Return Values
-------------
Common return values are documented here ::doc::`common_return_values`, the following are the fields unique to this module:
.. raw:: html
<pre>
@{ returndocs }@
</pre>
::
{% endif %}
{% if notes %}
{% for note in notes %}
.. note:: @{ note | convert_symbols_to_format }@
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment