ansible/ansible — pull request #1660 by jpmens (2012-11-22 13:10:41+00:00)
Title: CLI: ansible-doc shows lists of modules & module docs on command-line

## Show listing of all modules

ansible-doc -l

```
...
ohai Returns inventory data from _Ohai_
pause Pause playbook execution
ping Try to connect to host and return `pong` on success.
pip Manages Python library dependencies.
postgresql_db Add or remove PostgreSQL databases from a remote host.
postgresql_user Adds or removes a users (roles) from a PostgreSQL database.
raw Executes a low-down and dirty SSH command
script Runs a local script on a remote node
seboolean Toggles SELinux booleans.
selinux Change policy and state of SELinux
service Manage services.
setup Gathers facts about remote hosts
shell Execute commands in nodes.
slurp Slurps a file from remote nodes
subversion Deploys a subversion repository.
supervisorctl Manage the state of a program or group of programs running via ...
svr4pkg Manage Solaris SVR4 packages
template Templates a file out to a remote server.
user Manage user accounts
virt Manages virtual machines supported by libvirt
wait_for Waits for a given port to become accessible on a server.
yum Manages packages with the _yum_ package manager
```

## Display manual of one module

ansible-doc -m yum

```
> YUM (/Users/jpm/Auto/pubgit/ansible/ansible/library/yum)

Will install, upgrade, remove, and list packages with the _yum_
package manager.

Options:
o disablerepo
_repoid_ of repositories to disable for the install/update
operation These repos will not persist beyond the
transaction Multiple repos separated with a ',' New in
version 0.9.
o enablerepo
Repoid of repositories to enable for the install/update
operation. These repos will not persist beyond the
transaction multiple repos separated with a ',' New in
version 0.9.
o list
various non-idempotent commands for usage with
`/usr/bin/ansible` and _not_ playbooks. See examples.
o name
package name, or package specifier with version, like
`name-1.0`.
o state
whether to install (`present`, `latest`), or remove
(`absent`) a package. Choices : present,latest,absent.

yum name=httpd state=latest
yum name=httpd state=removed
yum name=httpd enablerepo=testing state=installed
```

## for insertion into playbook

ansible-doc -s -m yum

```yaml
- name: Manages packages with the _yum_ package manager
action: yum
disablerepo= # _repoid_ of repositories to disable for the ...
enablerepo= # Repoid of repositories to enable for the ...
list= # various non-idempotent commands for usage with ...
name= # package name, or package specifier with version, ...
state= # whether to install (`present`, `latest`), or ...
```