Skip to main content

Generate Documentation from Annotated Ansible Playbooks and Roles

Project description

ansible-docgen

Generate documentation from annotated Ansible playbooks and roles.

Tests PyPI version

Requirements

  • Python 3.10+

Installation

pip install ansible-docgen

Usage

1. Annotate your playbooks and roles

Add # Author: and # Description: comments at the top of your playbook or role task file:

---
# Author: John Doe
# Description: Install and configure a web server

- hosts: webservers
  tasks:
    - name: Install Apache
      yum:
        name: httpd
        state: installed
---
# roles/appserver/tasks/main.yml
# Author: John Doe
# Description: Appserver role

- name: Copy installer
  copy:
    src: installer
    dest: /tmp/
  tags:
    - copy-installer

- name: Run installer
  shell: /tmp/installer.sh
  tags:
    - run-installer

2. Generate documentation

Run from your project directory:

ansible-docgen

Or specify the project path explicitly:

ansible-docgen -p /path/to/your/ansible/project

This writes README.md files into your project, roles, and custom roles directories.

Warning: This will overwrite any existing README files in those directories.

CLI reference

usage: ansible-docgen [-h] [-p PROJECT] [-f FILENAME] [-s STYLE] [-i IGNORE] [-n] [-v]

options:
  -h, --help            show this help message and exit
  -p PROJECT, --project PROJECT
                        Path to Ansible project. Default is the current directory.
  -f FILENAME, --filename FILENAME
                        Output documentation filename (without extension). Default: README
  -s STYLE, --style STYLE
                        Output format. Default: markdown
  -i IGNORE, --ignore IGNORE
                        Comma-separated list of attributes to omit from output.
                        Example: -i author,task
  -n, --no-tags         Hide task tags in the output
  -v, --version         Print version and exit

Development

git clone https://github.com/outbit/ansible-docgen
cd ansible-docgen
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Run the tests:

pytest

Lint:

ruff check lib test

License

Released under the MIT 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_docgen-1.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

ansible_docgen-1.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file ansible_docgen-1.1.0.tar.gz.

File metadata

  • Download URL: ansible_docgen-1.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ansible_docgen-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7b7490ccdd58e5e8e945c98271f107b7488a92a2ce06f119cce936b4284074e6
MD5 4820d5439a7d7e2fd25c8f53c9083d9f
BLAKE2b-256 ea11b5aae20fafe986a60925385d2128b390729f9f15c15753079a4e99e3a6b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansible_docgen-1.1.0.tar.gz:

Publisher: deploy-prod.yml on outbit/ansible-docgen

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_docgen-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ansible_docgen-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ansible_docgen-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ef3afb07bb262a8eadf4699c9fe9d86eb20a610ff31e949af33b8cce23d5dd5
MD5 3910dfff4a83dc369d1661026734384d
BLAKE2b-256 b4c7ab791be64ff2671f574639e1ea7e5e4fc42940e547c6b4d070a329e3123e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansible_docgen-1.1.0-py3-none-any.whl:

Publisher: deploy-prod.yml on outbit/ansible-docgen

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