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
4b04d7a9
Commit
4b04d7a9
authored
Oct 12, 2012
by
Tim Bielawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add DOCUMENTATION for module documentation.
parent
dfaef806
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
1 deletions
+101
-1
docsite/DOCUMENTATION.yaml
+2
-0
docsite/rst/moduledev.rst
+66
-1
examples/DOCUMENTATION.yaml
+33
-0
No files found.
docsite/DOCUMENTATION.yaml
0 → 120000
View file @
4b04d7a9
../examples/DOCUMENTATION.yaml
\ No newline at end of file
docsite/rst/moduledev.rst
View file @
4b04d7a9
...
@@ -310,6 +310,72 @@ If you're writing a module in Python or Ruby or whatever, though, returning
...
@@ -310,6 +310,72 @@ If you're writing a module in Python or Ruby or whatever, though, returning
JSON is probably the simplest way to go.
JSON is probably the simplest way to go.
Documenting Your Module
```````````````````````
All modules included in the CORE distribution must have a
``DOCUMENTATION`` string. This string MUST be a valid YAML document
which conforms to the schema defined below. You may find it easier to
start writing your ``DOCUMENTATION`` string in an editor with YAML
syntax highlighting before you include it in your Python file.
Example
+++++++
Here's a correctly formatted YAML document we could use for a
``DOCUMENTATION`` string:
.. literalinclude:: ../DOCUMENTATION.yaml
This is available in the 'examples/' directory of the of the Ansible
github repository. You can copy it into your module and use it as a
starting point when writing your own docs.
Include it in your module file like this::
#!/usr/bin/env python
# Copyright header....
DOCUMENTATION = '''
---
module: modulename
short_description: This is a sentence describing the module
# ... snip ...
examples:
- code: modulename opt1=arg1 opt2=arg2
description: Optional words describing this example
'''
Building & Testing
++++++++++++++++++
Put your completed module file into the 'library' directory and then
run the command: ``make webdocs``. The new 'modules.html' file will be
built and appear in the 'docsite/' directory.
You can also test-build your docs one-by-one using the
``module_formatter.py`` script:
.. code-block:: bash
$ ./hacking/module_formatter.py -t man -M library/ -m git > ansible-git.1
$ man ./ansible-git.1
This will build a manpage for the git module, and look in the
'library/' directory for the module source. To see all the other
output formats available:
.. code-block:: bash
$ ./hacking/module_formatter.py -t --help
.. tip::
If you're having a problem with the syntax of your YAML you can
validate it on the `YAML Lint <http://www.yamllint.com/>`_ website.
Sharing Your Module
Sharing Your Module
```````````````````
```````````````````
...
@@ -343,4 +409,3 @@ the program. Stop by the mailing list to inquire about requirements.
...
@@ -343,4 +409,3 @@ the program. Stop by the mailing list to inquire about requirements.
Questions? Help? Ideas? Stop by the list on Google Groups
Questions? Help? Ideas? Stop by the list on Google Groups
`irc.freenode.net <http://irc.freenode.net>`_
`irc.freenode.net <http://irc.freenode.net>`_
#ansible IRC chat channel
#ansible IRC chat channel
examples/DOCUMENTATION.yaml
0 → 100644
View file @
4b04d7a9
---
# If a key doesn't apply to your module (ex: choices, default, or
# aliases) you can use the word 'null', or an empty list, [], where
# appropriate.
module
:
modulename
short_description
:
This is a sentence describing the module
description
:
-
Longer description of the module
-
You might include instructions
version_added
:
0.X
author
:
Your AWESOME name here
notes
:
-
Other things consumers of your module should know
requirements
:
-
list of required things
-
like the factor package
-
or a specic platform
options
:
# One or more of the following
option_name
:
description
:
-
Words go here
-
that describe
-
this option
required
:
true
or
false
default
:
a string or the word
null
choices
:
[
list
,
of
,
choices
]
aliases
:
[
list
,
of
,
aliases
]
version_added
:
0.X
examples
:
# One or more of the following:
-
code
:
modulename opt1=arg1 opt2=arg2
description
:
Optional words describing this example
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