Skip to content

Ansible call graph

Adam Spiers edited this page Feb 12, 2018 · 11 revisions

Graphing Ardana's playbooks, roles, tasks etc.

Since our playbooks are big and complex, it would be very helpful to be able to automatically generate visualizations of the relationships between the various components.

Tools which didn't help (so far)

  • ansible-roles-graph seems incredibly basic and didn't work.
  • ARA looks like an awesome tool, but it doesn't generate graphs. It also relies on run-time analysis, which has both pros and cons vs. static analysis.
  • ansigenome does lots of things we probably don't need, and also does graphing, but not very well (and it didn't work at all when @aspiers tried it).

ansible-viz

Was marked as a dead project, but nevertheless seems to be reasonably sophisticated - even has a test suite! @aspiers has revived this by fixing a load of bugs, adding a few enhancements, and taking over maintainership.

Usage

Here is a very cryptic HOWTO:

zypper in ruby2.1-rubygem-bundler
git clone https://github.com/aspiers/ansible-viz
cd ansible-viz/
bundle
bundle exec ruby ansible-viz.rb ~/ardana-dev-tools/ansible

This will generate viz.html in the current directory. You then need to serve this and also viz.js from some webserver, and then browse to the generated HTML page.

Known issues

The most important one is that it doesn't handle roles with no tasks, but see https://github.com/aspiers/ansible-viz/issues/ for the full list.

Example output

Here is some example output created when running on the ardana-dev-tools repository:

There are more examples from the same place.

See also

TODO

  • Run on the huge deployer Ansible codebase:

      bundle exec ruby ansible-viz.rb ~/scratch/ansible/next/ardana/ansible
    
  • Submit all the code changes and issues found upstream.