Skip to main content

Ansible Documentation Template Extractor

Project description

ansible-doc-template-extractor

ansible-doc-template-extractor is a documentation extractor that supports the format Ansible roles use in their meta/argument_specs.yml files as input, and arbitrary Jinja2 template files to control what is generated as output.

It can also be used for Ansible playbooks (and other Ansible items), as long as a spec file in YAML format is provided that documents it. The format can differ from the argument spec files for roles, but of course the template file needs to support the format of the spec file.

The format of the spec files for Ansible roles is described here: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#specification-format

Template files for Markdown and RST format for the spec files for Ansible roles are included with the ansible-doc-template-extractor package. You can write your own templates for other formats or for Ansible playbooks (and other Ansible items).

Disclaimer: The ansible-doc-template-extractor tool should be seen as a temporary bridge until there is official documentation extractin support for Ansible roles and playbooks. There have been discussions in Ansible forums to add support for Ansible roles to the ansible-doc and ansible-navigator tools. Once that happens, the ansible-doc-template-extractor tool is probably no longer needed for Ansible roles. In the event that an official spec format for Ansible playbooks gets defined one day and that this format gets supported by the ansible-doc and ansible-navigator tools, the ansible-doc-template-extractor tool is probably no longer needed at all.

Installation

If you want to install the package into a virtual Python environment:

$ pip install ansible-doc-template-extractor

Otherwise, you can also install it without depending on a virtual Python environment:

Example use

Suppose you have the following subtree:

├── my_collection
|   ├── roles
|       ├── my_role
|           └── meta
|               └── argument_specs.yml
├── docs

Then you can run the extractor as follows:

$ ansible-doc-template-extractor -o docs my_collection/roles/my_role/meta/argument_specs.yml
Loading template file: .../templates/role.md.j2
Ansible name: my_role
Loading spec file: my_collection/roles/my_role/meta/argument_specs.yml
Created output file: docs/my_role.md

This will create an .md file in Markdown format with the documentation of the role:

├── docs
│   └── my_role.md

Writing templates

The template files for roles and for the Markdown and RST formats are included with the installed ansible-doc-template-extractor package.

You can write your own templates for any other format or for Ansible playbooks.

The following rules apply for the templates:

  • The templating language is Jinja2.

  • The following Jinja2 extensions are available:

Reporting issues

If you encounter a problem, please report it as an issue on GitHub.

License

This package is licensed under the Apache 2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansible_doc_template_extractor-0.8.0.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file ansible_doc_template_extractor-0.8.0.tar.gz.

File metadata

File hashes

Hashes for ansible_doc_template_extractor-0.8.0.tar.gz
Algorithm Hash digest
SHA256 e1864df740a8fe71bc627824389e1a0b2ec8503dae11e13c881602fa92d846de
MD5 62078033ff0ed026e5ee1251a7a78d20
BLAKE2b-256 8c8e037848bbf2a9519992e8c5b06a812b7a7b8ae8e64510e0edd66800b42d5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansible_doc_template_extractor-0.8.0.tar.gz:

Publisher: publish.yml on andy-maier/ansible-doc-template-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ansible_doc_template_extractor-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ansible_doc_template_extractor-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf51f8d6bf5d3c3bd0c1c1e19cbd4e18109662b069067a84d53d4466880d0d14
MD5 b2a8a0fe607781bf635083411e71650f
BLAKE2b-256 cfc479ba5a0a525de3b65d247e308b5c830d312b5fcc8d173f7fd55d088bf0d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansible_doc_template_extractor-0.8.0-py3-none-any.whl:

Publisher: publish.yml on andy-maier/ansible-doc-template-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page