Extract Ansible module documentation
Project description
This package contains code for Ansible collection documentation extractor. Its main audience are Ansible collection maintainers that would like to publish API docs in the HTML form without having to manually copy the data already present in the module’s metadata.
Quickstart
Documentation extractor is published on PyPI and we can install it using pip:
$ pip install ansible-doc-extractor
If the previous command did not fail, we are ready to start extracting the documentation:
$ ansible-doc-extractor \ /tmp/output-folder \ ~/.ansible/collections/ansible_collections/my/col/plugins/modules/*.py
This will extract the documentation from modules in my.col collection and place resulting rst files into /tmp/output-folder.
Custom template
ansible-doc-extractor supports a custom Jinja2 template file via --template. The following variables are sent to the template:
Variable name |
Type |
Description |
Module’s documentation key |
---|---|---|---|
short_description |
str |
Short description of a module. |
short_description |
description |
str / list |
Longer description of a module, type depends on the module’s description type. |
description |
requirements |
list |
Requirements needed on the host that executes this module. |
requirements |
options |
dict |
All module options, often called parameters or arguments. |
options |
notes |
list |
Module’s additional notes. |
notes |
seealso |
list |
Details of any important information that doesn’t fit in one of the above sections. |
seealso |
deprecated |
str |
Marks modules that will be removed in future releases |
deprecated |
author |
str / list |
Author of the module, type can vary depending on how many authors module has. |
author |
metadata |
dict |
This section provides information about the module |
Refers to ANSIBLE_METADATA block in the module. |
examples |
str |
Code examples |
Refers to EXAMPLES block in the module. |
returndocs |
dict |
This section documents the information the module returns. |
Refers to RETURN block in the module. |
You can always refer to the default Jinja2 template.
Development setup
Getting development environment up and running is relatively simple if we have pipenv installed:
$ pipenv update
To test the extractor, we can run:
$ pipenv run ansible-doc-extractor
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ansible-doc-extractor-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d3406ee03d594784b42e55ca2b6cda2055afa47420a6f3de30f1607e7d6ff53 |
|
MD5 | f1ec3d25e4a21e39c360c6a827c91409 |
|
BLAKE2b-256 | a7353de118c97736daa2fc6b758d92798a55dc23913378187e25ab15fe67c281 |
Hashes for ansible_doc_extractor-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04922482cff9c52fa9b6a7a2bd73014419d341804f82b243db18ac0b0bd3c987 |
|
MD5 | ea401d03d2595dfdf688dee2ff484fa8 |
|
BLAKE2b-256 | a1452a3c0cab4a16602ec8b8f2322e50aac4c6b59b4e34365523f53b17870eb2 |