Skip to main content

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.

Release files for ansible-docgen 1.1.0

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-docgen 1.1.0
File Size Uploaded
ansible_docgen-1.1.0.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ansible-docgen 1.1.0
File Interpreter ABI Platform
ansible_docgen-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / ansible_docgen-1.1.0.tar.gz

Download URL ansible_docgen-1.1.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7b7490ccdd58e5e8e945c98271f107b7488a92a2ce06f119cce936b4284074e6
BLAKE2b-256 checksum
How to use checksums
ea11b5aae20fafe986a60925385d2128b390729f9f15c15753079a4e99e3a6b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / ansible_docgen-1.1.0-py3-none-any.whl

Download URL ansible_docgen-1.1.0-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ef3afb07bb262a8eadf4699c9fe9d86eb20a610ff31e949af33b8cce23d5dd5
BLAKE2b-256 checksum
How to use checksums
b4c7ab791be64ff2671f574639e1ea7e5e4fc42940e547c6b4d070a329e3123e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.4

2 release files

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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