-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display/export playbook graph #587
Comments
Hi @Hipska and thanks for the issue. I think ansible-playbook-grapher is great and fits in the definition of making playbooks easier to understand and troubleshoot :p I remember we discussed it briefly a while back, and I pondered on that for a wihle so thanks for reminding me about it. This is a bit verbose but here's my train of thought: It would be useful to have a graph of the playbook attached to the report somehow. I won't go into all the details here but ara used to have a dependency on ansible back in version 0.x and it caused a lot of headaches. Technical and legal ones. So how might we allow users to have playbook graphs in the UI without depending on ansible-playbook-grapher ? I considered different options and feel like I have settled on an idea worth discussing: using ara_record. We don't do much with the type of a record in the UI right now, but it is intended as a way for the consumer (i.e, the UI, the CLI) to know how to handle/parse/render the value of a key. What if we had a graph type ? ansible-playbook-grapher outputs as an image (svg), a mermaid flowchart (mmd) and .json. The raw json means we'd do our own rendering somehow and the mermaid flowchart requires mermaid.js (example in django here). That could be interesting? A generic way of attaching images (or screenshots?) to playbook reports. It could look like this (pseudocode): $ ansible-playbook-grapher -o playbook playbook.yml
$ export ARA_CALLBACK_PLUGINS=$(ansible.setup.callback_plugins)
$ ansible-playbook -i hosts playbook.yml # playbook.yml
- name: Include playbook graph in the report
ara_record:
key: playbook-graph
value: "{{ playbook_dir }}/playbook.svg"
type: image Then, in the UI, the user could see the image attached to the playbook. In this case it's a playbook graph but it could be any image, even images of cats. This supposes we want to store images in the database in order to keep everything easily portable, but it's not necessarily a great idea. Otherwise they would be uploaded via django and stored on disk which means if you transfer your sqlite database somewhere, the attachments won't follow unless you also transfer them over. It is a bit more complicated. It is not exactly what you have asked for but we could test what it looks like. |
I agree with wanting to keep ara package small and as less dependencies as possible. However, this surely counts for the Ansible plugins part ( On the other hand, I also like the idea of putting this info into records and be more smart on how to handle them in the UI. I did not use them yet, but will look into it. |
What is the idea ?
On the Playbook report page, a new section could show a graph indicating the relation of tasks versus their play(s)/role(s). Clicking a task on the graph could filter the list of task results of the playbook. It should be doable given the fact that ARA records the files.
The API and CLI could also support this by specifying one of the renderers.
Example UI
Example CLI
ara playbook graph 16 -f graphviz
References
The text was updated successfully, but these errors were encountered: