By default, the ansible-doc command will use module as the type, thus there is no need to use the -t or --type option followed by module to display documentation on modules. For example, the following commands will return the same exact output.
ansible-doc --list ansible-doc -t module --list ansible-doc --type module --list
The -l or --list option can be used to find plugins that contain a particular keyword, like this.
ansible-doc --list | grep copy ce_file_copy Copy a file to a remote cloudengine device over SCP on HUAWEI CloudEngine switches. copy Copies files to remote locations ec2_ami_copy copies AMI between AWS regions, return new image id ec2_snapshot_copy copies an EC2 snapshot and returns the new Snapshot ID. netapp_e_volume_copy Create volume copy pairs nxos_file_copy Copy a file to a remote NXOS device over SCP. unarchive Unpacks an archive after (optionally) copying it from the local machine. vsphere_copy Copy a file to a vCenter datastore win_copy Copies files to remote locations on windows hosts win_robocopy Synchronizes the contents of two directories using Robocopy
Let's say you want to learn about the "copy" module. The -s or --snippet option can be used.
ansible-doc --snippet copy - name: Copies files to remote locations copy: attributes: # Attributes the file or directory should have. To get supported flags look at the man page for `chattr' on the target system. This string should contain the attributes in the same order as the one backup: # Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. content: # When used instead of `src', sets the contents of a file directly to the specified value. For anything advanced or with formatting also look at the template module. decrypt: # This option controls the autodecryption of source files using vault. dest: # (required) Remote absolute path where the file should be copied to. If `src' is a directory, this must be a directory too. If `dest' is a nonexistent path and if either `dest' ends with "/" or `src' is a directory, `dest' is created. If `src' and `dest' are files, the parent directory of `dest' isn't created: the task fails if it doesn't already exist. directory_mode: # When doing a recursive copy set the mode for the directories. If this is not set we will use the system defaults. The mode is only set on directories which are newly created, and will not affect those that already existed. follow: # This flag indicates that filesystem links in the destination, if they exist, should be followed. force: # the default is `yes', which will replace the remote file when contents are different than the source. If `no', the file will only be transferred if the destination does not exist. group: # Name of the group that should own the file/directory, as would be fed to `chown'. local_follow: # This flag indicates that filesystem links in the source tree, if they exist, should be followed. mode: # Mode the file or directory should be. For those used to `/usr/bin/chmod' remember that modes are actually octal numbers (like 0644). Leaving off the leading zero will likely have unexpected results. As of version 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx' or `u=rw,g=r,o=r'). owner: # Name of the user that should own the file/directory, as would be fed to `chown'. remote_src: # If `no', it will search for `src' at originating/master machine. If `yes' it will go to the remote/target machine for the `src'. Default is `no'. Currently `remote_src' does not support recursive copying. selevel: # Level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range'. `_default' feature works as for `seuser'. serole: # Role part of SELinux file context, `_default' feature works as for `seuser'. setype: # Type part of SELinux file context, `_default' feature works as for `seuser'.