# Using dependency graphs to speed up ansible?

**URL:** <https://forum.ansible.com/t/using-dependency-graphs-to-speed-up-ansible/17031>\
**Category:** Ansible Project\
**Created:** [December 11, 2014, 7:48pm UTC](https://forum.ansible.com/t/using-dependency-graphs-to-speed-up-ansible/17031 "2014-12-11T19:48:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Burton](https://avatars.discourse-cdn.com/v4/letter/k/dec6dc/32.png) [@Kevin\_Burton](https://forum.ansible.com/u/Kevin_Burton)\
**Post date:** [December 11, 2014, 7:48pm UTC](https://forum.ansible.com/t/using-dependency-graphs-to-speed-up-ansible/17031/1 "2014-12-11T19:48:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [December 11, 2014, 8:18pm UTC](https://forum.ansible.com/t/using-dependency-graphs-to-speed-up-ansible/17031/2 "2014-12-11T20:18:06Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 11, 2014, 8:24pm UTC](https://forum.ansible.com/t/using-dependency-graphs-to-speed-up-ansible/17031/3 "2014-12-11T20:24:14Z")

</div>

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](http://www.ansible.com/blog/ansible-performance-tuning) if you have not already.
