Documenting your module
One great feature of Ansible is its built-in documentation. Similar to man pages on a Unix system, we can use the ansible-doc
command to get a summary of the module's functionality, which arguments it accepts, which values can be expected to be returned, as well as examples on how to use the module in your playbooks.
However, if we run the ansible-doc
command on the module created in the Setting up the module structure recipe, you'll be left with an error message stating that the module is missing documentation:
Ansible does not require us to provide any additional files to serve as the documentation that is retrieved and presented to the user by the ansible-doc
command. Rather, we embed the documentation into the Ansible module itself, and this is exactly what we are going to do in this recipe.