提取Ansible模块文档
ansible-doc-extractor的Python项目详细描述
此包包含Ansible集合文档提取器的代码。它 主要读者是希望发布的Ansible集合维护者 HTML格式的API文档,无需手动复制数据 存在于模块的元数据中。在
快速启动
文档提取器发布在PyPI上,我们可以使用 pip:
$ pip install ansible-doc-extractor
如果上一个命令没有失败,我们就可以开始提取 文件:
^{pr2}$这将从my.col集合中的模块提取文档,并 将生成的rst文件放入/tmp/output-folder。在
注意
始终从已安装的集合中提取文档。文档 片段加载器无法组合文档的各个部分 否则。在
自定义模板
ansible文档提取器通过--template支持自定义Jinja2模板文件。以下变量 发送到模板:
Variable name | Type | Description | Module’s documentation key |
---|---|---|---|
short_description | str | Short description of a module. | short_description |
description | str / list | Longer description of a module, type depends on the module’s description type. | description |
requirements | list | Requirements needed on the host that executes this module. | requirements |
options | dict | All module options, often called parameters or arguments. | options |
notes | list | Module’s additional notes. | notes |
seealso | list | Details of any important information that doesn’t fit in one of the above sections. | seealso |
deprecated | str | Marks modules that will be removed in future releases | deprecated |
author | str / list | Author of the module, type can vary depending on how many authors module has. | author |
metadata | dict | This section provides information about the module | Refers to ANSIBLE_METADATA block in the module. |
examples | str | Code examples | Refers to EXAMPLES block in the module. |
returndocs | dict | This section documents the information the module returns. | Refers to RETURN block in the module. |
您可以始终引用default Jinja2 template。在
开发设置
如果我们 已安装pipenv:
$ pipenv update
要测试提取器,我们可以运行:
$ pipenv run ansible-doc-extractor
- 项目
标签: