# IoC in ansible roles (avoiding boilerplate) - how?

**URL:** <https://forum.ansible.com/t/ioc-in-ansible-roles-avoiding-boilerplate-how/17247>\
**Category:** Ansible Project\
**Created:** [January 13, 2015, 10:47am UTC](https://forum.ansible.com/t/ioc-in-ansible-roles-avoiding-boilerplate-how/17247 "2015-01-13T10:47:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jang](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@jang](https://forum.ansible.com/u/jang)\
**Post date:** [January 13, 2015, 10:47am UTC](https://forum.ansible.com/t/ioc-in-ansible-roles-avoiding-boilerplate-how/17247/1 "2015-01-13T10:47:34Z")

</div>

So, a follow-on question. I've a number of roles (again, role playbooks  
are potentially developed by independent teams). Typically, the tasks any  
particular role will execute look like this:

- common preamble  
- role-specific tasks  
- common suffix.

I'd like to minimise (or remove) any common boilerplate from each of the  
individual roles. Typically, the way to achieve that is via some take on  
IoC. However, given that include: doesn't expand J2, I'm finding it hard  
to understand how one might best express this in ansible.

Any clues?

Cheers,  
jan
