# Rolling deploys to groups of servers

**URL:** <https://forum.ansible.com/t/rolling-deploys-to-groups-of-servers/18895>\
**Category:** Ansible Project\
**Created:** [July 29, 2015, 9:03pm UTC](https://forum.ansible.com/t/rolling-deploys-to-groups-of-servers/18895 "2015-07-29T21:03:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_Matz1](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@Guy\_Matz1](https://forum.ansible.com/u/Guy_Matz1)\
**Post date:** [July 29, 2015, 9:03pm UTC](https://forum.ansible.com/t/rolling-deploys-to-groups-of-servers/18895/1 "2015-07-29T21:03:05Z")

</div>

Hello!

I have the requirement to perform rolling deploys to groups of servers at a time, e.g. the first set of servers - app1\_server\_1, app2\_server\_1, app3\_server1 - first, then the second set - app1\_server2, app2\_server2, app3\_server2 - then the third set, app1\_server3, app2\_server3, app3\_server3, etc.

Anyone know of a good way to do this in ansible?

Thanks a lot,

Guy

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 29, 2015, 11:13pm UTC](https://forum.ansible.com/t/rolling-deploys-to-groups-of-servers/18895/2 "2015-07-29T23:13:41Z")

</div>

several, one way is:

- hosts: app\*\_server1:app\*\_server2:app\*\_server3  
&nbsp;&nbsp;serial: 3

---

<div class="post-metadata">

**Author:** ![Offer\_Sharabi](https://avatars.discourse-cdn.com/v4/letter/o/f07891/32.png) [@Offer\_Sharabi](https://forum.ansible.com/u/Offer_Sharabi)\
**Post date:** [July 30, 2015, 12:52pm UTC](https://forum.ansible.com/t/rolling-deploys-to-groups-of-servers/18895/3 "2015-07-30T12:52:05Z")

</div>

Hi Guy,  
First you need a way to refer to your servers in the required release order. Easy way is to just have them as a group in your host file such as:

[servers]  
server1  
server2  
server3  
…  
serverN

Then in your rolling deploy playbook, you refer to this group as hosts, and use serial=1 if you would like Ansible to finish all apps in one server before moving on to the next one.

To force the app order, you can create task lists for each deploy, and then include them in order, such as:

hosts: servers  
serial:1  
.  
.  
.  
tasks:

- include : deploy\_app1
- include: deploy\_app2
- include: deploy\_app3

Hope it helps !

---

<div class="post-metadata">

**Author:** ![Guy\_Matz](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Guy\_Matz](https://forum.ansible.com/u/Guy_Matz)\
**Post date:** [July 30, 2015, 4:28pm UTC](https://forum.ansible.com/t/rolling-deploys-to-groups-of-servers/18895/4 "2015-07-30T16:28:10Z")

</div>

Great! That looks like it’ll work! What’s another way? 😉

Thanks,

Guy
