Ansible Playbook Grapher: Difference between revisions
No edit summary |
m tagged |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
If you use Ansible for automation, then you should be interested in a tool called [https://github.com/haidaraM/ansible-playbook-grapher Ansible Playbook Grapher] which allows you to visualize the workflow of your playbooks. | If you use Ansible for automation, then you should be interested in a tool called [https://github.com/haidaraM/ansible-playbook-grapher '''Ansible Playbook Grapher'''] which allows you to visualize the workflow of your playbooks. | ||
I ran into [https://github.com/freephile/meza/issues/63 a little trouble getting it to work initially], but eventually was able to output graphs for Meza. | I ran into [https://github.com/freephile/meza/issues/63 a little trouble getting it to work initially], but eventually was able to output graphs for Meza. | ||
Although you can output [[Mermaid]] graphs ([[Ansible Playbook Grapher with Mermaid|see example]]) in lieu of the default [[SVG]], the SVG format is richer, more functional and can handle large complex graphs more easily. | |||
[[File:Ansible-playbook-grapher illustration of meza site playbook.svg|thumb]] | [[File:Ansible-playbook-grapher illustration of meza site playbook.svg|thumb]] | ||
== Usage == | == Usage == | ||
The way to use '''ansible-playbook-grapher''' is to setup a [[Python_deployments#Basic_PIP_and_Virtual_Environments|Python Virtual Environment]], so that you can install '''apg'''. Once it is installed, you can use it on a checkout of [[Meza]] by changing into the 'config' directory and invoking the script with optional arguments <code>ansible-playbook-grapher --include-role-tasks ../src/playbooks/site.yml</code> | The way to use '''ansible-playbook-grapher''' is to setup a [[Python_deployments#Basic_PIP_and_Virtual_Environments|Python Virtual Environment]], so that you can install '''apg'''. Once it is installed, you can use it on a checkout of [[Meza]] by changing into the 'config' directory and invoking the script with optional arguments <code>ansible-playbook-grapher --include-role-tasks ../src/playbooks/site.yml</code> | ||
| Line 23: | Line 23: | ||
# Also graph the tasks (creates a much bigger graph) | # Also graph the tasks (creates a much bigger graph) | ||
ansible-playbook-grapher --include-role-tasks --open-protocol-handler vscode --collapsible-nodes --title 'Meza site playbook' -vvv ../src/playbooks/site.yml | ansible-playbook-grapher --include-role-tasks --open-protocol-handler vscode --collapsible-nodes --title 'Meza site playbook' -vvv ../src/playbooks/site.yml | ||
</syntaxhighlight> | </syntaxhighlight>Here's the graph with all the tasks shown | ||
[[File:Ansible-playbook-grapher illustration of meza site playbook with tasks.svg|left|thumb|2728x2728px]] | |||
[[Category:Diagrams]] | |||
[[Category:Ansible]] | |||
[[Category:Meza]] | |||
[[Category:Python]] | |||