# Parallel deployment

**URL:** <https://forum.ansible.com/t/parallel-deployment/22492>\
**Category:** Ansible Project\
**Created:** [September 6, 2016, 9:55am UTC](https://forum.ansible.com/t/parallel-deployment/22492 "2016-09-06T09:55:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcoskv](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@marcoskv](https://forum.ansible.com/u/marcoskv)\
**Post date:** [September 6, 2016, 9:55am UTC](https://forum.ansible.com/t/parallel-deployment/22492/1 "2016-09-06T09:55:08Z")

</div>

Hello Ansible users!

I am looking for suggestions for my particular use case, for which I could not find many other solution online.

Let’s say my web application runs on 2 servers: 1 web-server + 1 db server.

To deploy each one of my servers, I have a playbook like one of the followings.

web\_server.yml —

- hosts: web\_server

roles:

- network

- apache

- firewall

db\_server.yml —

- hosts: db\_server

roles:

- network

- mysql

- firewall

Each “type” of server has a different set of roles, and I have just one server per type.

I am trying to write a main.yml that deploys web\_server and db\_server in parallel.

If I use “include” in main.yml, the playbooks are executed in a sequence. The only way I found to run everything in parallel is to use roles with whens, like

main.yml —

- hosts: all

strategy: free

roles:

- network

- role: mysql

when: inventory\_hostname in groups.db\_server

- role: apache

when: inventory\_hostname in groups.web\_server

- firewall

The only cons of this approach is that with 10 different server types and 20 different roles, the playbook is not that readable.

Are there better ways to solve this use case?

Many thanks,

Marco
