Using dependency graphs to speed up ansible?

Has anyone done any work on using dependency graphs to speed up ansible.

For example, if I have one big site.yml, and I only change an edge role, something small, it doesn’t make sense to re-run ALL playbooks.

There might be situations where this makes sense. There might be some API dependencies though but maybe you could hard code some exemptions for dependency computation.

This is generally how incremental compilers work btw. No sense recompiling your whole app if dependencies haven’t changed.

Hi Kevin,

This is probably something better suited for ansible-devel, however to answer your question we do already provide several methods for limiting the scope of playbook runs (–tags, --start-at-task, --step, etc.). Ansible is really very linear, even when considering role dependencies (we compile everything down into a single list of tasks, and iterate through that), so there’s no crazy dependency resolution to fix.

Also, there is the added complication that things on remote targets may have changed, so in general you would not want to automatically limit the execution of a playbook to only those parts of the play which have changed on the controlling machine.

While your suggestion might be technically possible, it definitely seems overly complex for what Ansible does. If you only need to re-run a single role or even a small subset of tasks, it is pretty trivial to create a new playbook to do so.

Thanks!

Yep, I would highly recommend tags to reference just the stuff you changed.

There is nothing that is going to monitor what files you edited automatically - that’s a bit too complex of a problem and not a use case we’re interested in.

Do read http://www.ansible.com/blog/ansible-performance-tuning if you have not already.