# Asynchronously calling roles

**URL:** <https://forum.ansible.com/t/asynchronously-calling-roles/24071>\
**Category:** Ansible Project\
**Created:** [March 27, 2017, 5:36pm UTC](https://forum.ansible.com/t/asynchronously-calling-roles/24071 "2017-03-27T17:36:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Santiago](https://avatars.discourse-cdn.com/v4/letter/n/b19c9b/32.png) [@Nicholas\_Santiago](https://forum.ansible.com/u/Nicholas_Santiago)\
**Post date:** [March 27, 2017, 5:36pm UTC](https://forum.ansible.com/t/asynchronously-calling-roles/24071/1 "2017-03-27T17:36:47Z")

</div>

I’m looking to call groups of roles at the same time in an asynchronous fashion, but have yet to figure out how to do so. My playbook is relatively simple:

> * * *
> 
> # release.yml
> 
> - hosts: “{{ host\_group }}”
> 
> remote\_user: “{{ release\_user }}”
> 
> serial: 99
> 
> vars\_files:
> 
> - release\_vars.yml
> 
> roles:
> 
> - { role : release\_copy\_srl\_files, when : dmgr != ‘yes’ }
> 
> - { role : release\_copy\_reporting\_jars, when : reportingServer == ‘true’ }
> 
> - { role : release\_deploy\_portal\_ears, when : dmgr == ‘yes’ }
> 
> - { role : release\_deploy\_portal\_paa, when : primaryNode == ‘true’ }
> 
> - { role : release\_deploy\_portal\_paa, when : secondaryNode == ‘true’ }
> 
> - { role : release\_deploy\_appserver\_ears, when : dmgr == ‘yes’ }
> 
> - { role : release\_start\_checkout\_IHS, when : ihs\_checkout == ‘true’ }

No host will have multiple conditions met in the when statements. Being able to run these simultaneously would save about the amount of time that it’d take to have a human do the job, so the goal is to optimize this playbook to the extent that we can.

Any suggestions?

Thanks!  
Nick

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 29, 2017, 11:54am UTC](https://forum.ansible.com/t/asynchronously-calling-roles/24071/2 "2017-03-29T11:54:21Z")

</div>

Have a look at this presentation - the last part covers various ways you can run playbooks in parallel.

[http://www.slideshare.net/bcoca/more-tips-n-tricks](http://www.slideshare.net/bcoca/more-tips-n-tricks)

There’s some more discussion here [https://github.com/ansible/proposals/issues/31](https://github.com/ansible/proposals/issues/31) and mention of various other tools you could use to wrap ansible to achieve parallel runs.

Hope this helps,

Jon
