Testing module documentation

Before you submit a module for inclusion in the main Ansible repo, you must test your module documentation for correct HTML rendering and to ensure that the argspec matches the documentation in your Python file. The community pages offer more information on testing reStructuredText documentation.

To check the HTML output of your module documentation:

  1. Ensure working development environment.

  2. Install required Python packages (drop ‘–user’ in venv/virtualenv):

    pip install --user -r requirements.txt
    pip install --user -r docs/docsite/requirements.txt
    
  3. Ensure your module is in the correct directory: lib/ansible/modules/$CATEGORY/mymodule.py.

  4. Build HTML from your module documentation: MODULES=mymodule make webdocs.

  5. To build the HTML documentation for multiple modules, use a comma-separated list of module names: MODULES=mymodule,mymodule2 make webdocs.

  6. View the HTML page at file:///path/to/docs/docsite/_build/html/modules/mymodule_module.html.

To ensure that your module documentation matches your argument_spec:

  1. Install required Python packages (drop ‘–user’ in venv/virtualenv):

    pip install --user -r test/runner/requirements/sanity.txt
    
  2. run the validate-modules test:

    ansible-test sanity --test validate-modules mymodule