title: Ansible - generate .rst file from module's DOCUMENTATION string
body: <p>I have written custom Ansible module and documented it using standard Ansible convention, <em>i.e.</em> by writing <code>DOCUMENTATION</code> and <code>EXAMPLES</code> global strings in module file.</p>
  
  <p>I already have some of the documentation generated using <code>Sphinx 1.8.3</code> and hosted locally. I would like to have Ansible documenation included in Sphinx generated pages. My directory structure is fairly simple:</p>
  
  <pre><code>./ansible/docs
  ├── conf.py
  ├── index.rst
  ├── _static
  └── _templates
  ./ansible/library/
  ├── __init__.py
  └── module.py
  </code></pre>
  
  <p>Now, I could write documentation as function docstrings and then include it using Sphinx <code>.. automodule::</code> directive. This works, but uses different format than Ansible <code>DOCUMENTATION</code> string.</p>
  
  <p>Although <a href="https://docs.ansible.com/ansible/2.7/dev_guide/developing_modules_documenting.html" rel="nofollow noreferrer">Ansible module documentation</a> goes on in depth, how the docstrings should be formatted, it does not seem to provide any information how to generate docs locally.</p>
  
  <p>What is the correct way to convert Ansible module documentation to <code>.rst</code> file, so that it could be included by <code>Sphinx</code>?</p>