一个命令行工具,用于创建一个表示可负责的剧本任务和角色的图形
ansible-playbook-grapher的Python项目详细描述
Ansible Playbook图示器
ansible-playbook-grapher是一个命令行工具,用于创建一个表示可负责的剧本任务和角色的图形。目的 这个项目是快速有一个你的行动手册的概述。
灵感来自Ansible Inventory Grapher。
先决条件
ansibe>;=2.7:脚本尚未使用ansibe的早期版本进行测试,某些功能可能无法工作。如果您仍然使用Ansible的旧版本,请创建一个虚拟环境并安装Ansible Playbook Grapher。
pip install
将安装ansibe>;=2.7的版本graphviz:用于在svg中生成图形的工具。
$ sudo apt-get install graphviz # or yum install or brew install
安装
$ pip install ansible-playbook-grapher
用法
$ ansible-playbook-grapher tests/fixtures/example.png
$ ansible-playbook-grapher --include-role-tasks examples/example_with_roles.yml
有些选项可用:
$ ansible-playbook-grapher --help
Usage: ansible-playbook-grapher [options] playbook.yml
Make graph from your Playbook.
Options:
--ask-vault-pass ask for vault password
-e EXTRA_VARS, --extra-vars=EXTRA_VARS
set additional variables as key=value or YAML/JSON, if
filename prepend with @
-h, --help show this help message and exit
--include-role-tasks Include the tasks of the role in the graph.
-i INVENTORY, --inventory=INVENTORY
specify inventory host path (default=[%s]) or comma
separated host list.
--new-vault-id=NEW_VAULT_ID
the new vault identity to use for rekey
--new-vault-password-file=NEW_VAULT_PASSWORD_FILES
new vault password file for rekey
-o OUTPUT_FILE_NAME, --ouput-file-name=OUTPUT_FILE_NAME
Output filename without the '.svg' extension. Default:
<playbook>.svg
-s, --save-dot-file Save the dot file used to generate the graph.
--skip-tags=SKIP_TAGS
only run plays and tasks whose tags do not match these
values
-t TAGS, --tags=TAGS only run plays and tasks tagged with these values
--vault-id=VAULT_IDS the vault identity to use
--vault-password-file=VAULT_PASSWORD_FILES
vault password file
-v, --verbose verbose mode (-vvv for more, -vvvv to enable
connection debugging)
--version show program's version number and exit
贡献
欢迎捐款。通过创建问题或提交PR:smiley:
开发环境
要设置新的开发环境:
- 安装graphviz
sudo apt-get install graphviz # or yum install or brew install graphviz
- pip install-r requirements.txt
使用以下命令运行测试:
$ make test
待办事项
- graphviz:正确排列图的边缘,以表示任务和角色的执行顺序
- graphviz:找到避免或减少边重叠的方法
- 重构图形表示法