ansible/ansible — pull request #7035 by smoothify (2014-04-17 15:41:14+00:00)
Title: Add pre_tasks and post_tasks for roles.

This is something i've wanted for a while; the ability to have pre_tasks and post_tasks for each role.

My primary use case is apt (or yum) sources, to avoid unnecessarily calling apt-get update many times.

The idea would be that in the pre_tasks of a role, all the keys and repos would be set - if there are changes then apt-update is run once, otherwise it is not run. This would help me in re-running the playbook periodically for configuration updates with out the delay each time.

I tried to keep the changes as simple and as consistent as possible with that is already there, even though this area of code could probably do with some refactoring to reduce duplication.