Skip to main content

ansible-autodoc

CircleCI

Generate documentation from annotated playbooks and roles using templates.

Note: this project is currently in Beta, issues, ideas and pull requests are welcome.

Features

  • allow to document playbook projects and roles
  • use templates to generate and maintain the documentation
  • extended functions when documenting:
    • tags: the autodoc will search for used tags in the project

Getting started

# install 
pip install ansible-autodoc

# print help 
ansible-autodoc -h 

# print parsed annotation results in the cli 
ansible-autodoc -p all path/to/role_or_playbook 

# generate README file based on annotations  
ansible-autodoc [path/to/project] 

notes:

  • you can use grip to see the live changes.
  • this only runs with python 3, if you still have python 2.x use pip3

Annotations

Use the following annotations in your playbooks and roles

  • meta: use @meta to annotate the metadata of playbook or role, like author check below list of useful metadata
    • author: (self explanatory)
    • description: playbook / role description
    • name: to define a different role/project name instead of the folder name
    • license: (self explanatory)
    • email: (self explanatory)
# @meta author: Author Name
# @meta description: Project description
  • todo: use @todo to annotate improvements, bugs etc
# @todo bug: bug description
# @todo improvement: improvement 
  • action: use @action to annotate a actions performed by the playbook/role
# @action install # this action describes the installation  
# @action # this action does not have a section, only description 
  • tags: use @tag to annotate tags, this is a special annotation as this will not only search for annotations, but also for used tags in the project and add that to the generated output.
# @tag tagname # tag description   
  • variables: use @var this to annotate configuration variables
# @var my_var: default_value # description of the variable   
  • example: the idea is that after every annotation, we can define an example block, linked to the annotation. in this case the example will be part of the var annotation.
# @var my_var: default_value # description of the variable   
my_var: default_value
# @example # the hash is needed due to the parser constrains
# my_var:
#  - subitem: string
#  - subitem2: string
# @end

Templates

ansible-autodoc comes with 3 templates out of the box, the default is "readme", you can change this in configuration.

If you want to create your own project specific templates, see the template documentation

If a file already exists in the output, the you will be prompted to overwrite or abort.

README

The default "readme" template will generate a README.md file in the root of the project, detailing the sections:

  • title and description
  • actions
  • tags
  • variables
  • todos
  • license
  • author infomration

you can extend this my creating a file "_readme_doby.md" in the root of your project, this will be included in the rendered Readme just after the initial description.

Doc and README

The "doc_and_readme" template is an extended template intended to be used playbook projects with several roles, it will generate a minimal README.md file and a documentation subfolder "doc" with more detailed information.

you can extend this my creating a file "_readme_doby.md" in the root of your project, this will be included in the rendered Readme just after the initial description.

the files created in the documentation folder will cover:

  • tags: list all tags classified by roles
  • variables: list all variables classified by roles
  • todo: list all todo actions classified by roles
  • report: provides a report of the project and useful information during development

you can extend the documentation in this folder, just keep in mind that generated files will be overwritten.

Command line

The "cliprint" template is used to display the content when you use the command line print parameter "-p"

Configuration

you can create a configuration file "autodoc.config.yaml" in the root of your project in order to modify several behaviours, see the sample config file for more details:

# role or project with playbooks
$ cd <project> 

# create sample configuration (optional) 
# you can pass the options as parameters too
$ ansible-autodoc --sample-doc > autodoc.config.yaml

Metadata

Release files for ansible-autodoc 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ansible-autodoc 0.5.3
File Size Uploaded Provenance
ansible-autodoc-0.5.3.tar.gz 19.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ansible-autodoc 0.5.3
File Interpreter ABI Platform
ansible_autodoc-0.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 47.8 kB

Release files / ansible-autodoc-0.5.3.tar.gz

Download URL ansible-autodoc-0.5.3.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3a741e251853f665805a0ba717acf510e4f38459db05cacf033e8278db0a6528
BLAKE2b-256 checksum
How to use checksums
c34bf09749e7b52e3b3d507d73c76738e20199ffaf476dd58ec6c01c2a28b02d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7

Release files / ansible_autodoc-0.5.3-py3-none-any.whl

Download URL ansible_autodoc-0.5.3-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38c4d428bf8c5d2f01c83cd3e42ea9b935bb11be47f115f9d24e36dae51fb8c8
BLAKE2b-256 checksum
How to use checksums
9cd5a561c1347d4c315c384c229a491f37b669cbb8b0cdfff41a18430e4dd158
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7

Security for ansible-autodoc 0.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page