Generate Documentation from Annotated Ansible Playbooks and Roles
Project description
ansible-docgen
Generate documentation from annotated Ansible playbooks and roles.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b7490ccdd58e5e8e945c98271f107b7488a92a2ce06f119cce936b4284074e6
|
|
| MD5 |
4820d5439a7d7e2fd25c8f53c9083d9f
|
|
| BLAKE2b-256 |
ea11b5aae20fafe986a60925385d2128b390729f9f15c15753079a4e99e3a6b5
|
Provenance
The following attestation bundles were made for ansible_docgen-1.1.0.tar.gz:
Publisher:
deploy-prod.yml on outbit/ansible-docgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ansible_docgen-1.1.0.tar.gz -
Subject digest:
7b7490ccdd58e5e8e945c98271f107b7488a92a2ce06f119cce936b4284074e6 - Sigstore transparency entry: 1496817559
- Sigstore integration time:
-
Permalink:
outbit/ansible-docgen@d5abfcbc45a61b9422bf2cf1ffcfc89a2ef08e5b -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/outbit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy-prod.yml@d5abfcbc45a61b9422bf2cf1ffcfc89a2ef08e5b -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ef3afb07bb262a8eadf4699c9fe9d86eb20a610ff31e949af33b8cce23d5dd5
|
|
| MD5 |
3910dfff4a83dc369d1661026734384d
|
|
| BLAKE2b-256 |
b4c7ab791be64ff2671f574639e1ea7e5e4fc42940e547c6b4d070a329e3123e
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ansible_docgen-1.1.0-py3-none-any.whl -
Subject digest:
0ef3afb07bb262a8eadf4699c9fe9d86eb20a610ff31e949af33b8cce23d5dd5 - Sigstore transparency entry: 1496818023
- Sigstore integration time:
-
Permalink:
outbit/ansible-docgen@d5abfcbc45a61b9422bf2cf1ffcfc89a2ef08e5b -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/outbit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy-prod.yml@d5abfcbc45a61b9422bf2cf1ffcfc89a2ef08e5b -
Trigger Event:
push
-
Statement type: