# Generate docs from ansible argspec

**URL:** <https://forum.ansible.com/t/generate-docs-from-ansible-argspec/35889>\
**Category:** Ansible Project\
**Created:** [October 18, 2021, 7:10am UTC](https://forum.ansible.com/t/generate-docs-from-ansible-argspec/35889 "2021-10-18T07:10:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![profhase85](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@profhase85](https://forum.ansible.com/u/profhase85)\
**Post date:** [October 18, 2021, 7:10am UTC](https://forum.ansible.com/t/generate-docs-from-ansible-argspec/35889/1 "2021-10-18T07:10:59Z")

</div>

Is there any way to generate a markdown documentation from ansible role argument spec?

[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_reuse\_roles.html#role-argument-validation](https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-argument-validation)

I could not find anything in ansible-doc, the format itself suggests that there is a way

Thanks a lot

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [October 20, 2021, 1:57pm UTC](https://forum.ansible.com/t/generate-docs-from-ansible-argspec/35889/2 "2021-10-20T13:57:50Z")

</div>

Hi,

> Is there any way to generate a markdown documentation from ansible  
> role argument spec?
> 
> [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_reuse\_roles.html#role-argument-validation](https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-argument-validation)
> 
> I could not find anything in ansible-doc, the format itself suggests  
> that there is a way

this doesn't really answer your question (as it's producing  
ReStructured Text and not MarkDown), but antsibull-docs  
([https://github.com/ansible-community/antsibull/](https://github.com/ansible-community/antsibull/)) also supports roles  
(with role argument specs) next to plugins and modules.

Cheers,  
Felix

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 2, 2022, 2:03pm UTC](https://forum.ansible.com/t/generate-docs-from-ansible-argspec/35889/3 "2022-11-02T14:03:05Z")

</div>

`ansible-doc -t role --json <rolename>` will dump the info in JSON format, you can then use that with almost any templating engine to create a markdown formatted file.
