LinuxCommandLibrary

ansible-doc

Display documentation for Ansible modules and plugins

TLDR

Show documentation for a module
$ ansible-doc [apt]
copy
List all available modules
$ ansible-doc -l
copy
List modules matching pattern
$ ansible-doc -l | grep [docker]
copy
Show snippet for module usage
$ ansible-doc -s [yum]
copy
Show documentation for collection module
$ ansible-doc [community.docker.docker_container]
copy
List plugins of a type
$ ansible-doc -t [callback] -l
copy

SYNOPSIS

ansible-doc [-l] [-s] [-t type] [module]

DESCRIPTION

ansible-doc displays documentation for Ansible modules, plugins, and collections. It shows module parameters, return values, examples, and notes, serving as a quick reference without needing to access online documentation.
The tool can list all available modules and filter by plugin type, making it useful for discovering available automation options.

PARAMETERS

-l, --list

List available modules or plugins
-s, --snippet
Show playbook snippet for module
-t type, --type type
Plugin type: module, callback, connection, lookup, etc.
-F, --list_files
Show module source files
-j, --json
Output in JSON format
-M path, --module-path path
Additional module search path

CONFIGURATION

ansible.cfg

Main Ansible configuration file, searched in current directory, ~/.ansible.cfg, or /etc/ansible/ansible.cfg.
ANSIBLE_CONFIG
Environment variable to specify an alternate configuration file path.

CAVEATS

Documentation quality varies between core and community modules. Some modules may have outdated documentation. Collection modules use fully qualified names.

HISTORY

ansible-doc has been part of Ansible since early versions, providing offline access to module documentation. Collections support was added with Ansible 2.9 in 2019.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard