Rolling deploys to groups of servers

26 views
Skip to first unread message

Guy Matz

unread,
Jul 29, 2015, 5:03:14 PM7/29/15
to ansible...@googlegroups.com
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

Brian Coca

unread,
Jul 29, 2015, 7:13:45 PM7/29/15
to Ansible Project
several, one way is:

- hosts: app*_server1:app*_server2:app*_server3
serial: 3


--
Brian Coca

Offer Sharabi

unread,
Jul 30, 2015, 8:52:05 AM7/30/15
to Ansible Project, guy...@gmail.com
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 !

Guy Matz

unread,
Jul 30, 2015, 12:28:15 PM7/30/15
to ansible...@googlegroups.com, Sergey Gladkovich
Great!  That looks like it'll work!  What's another way?  ;-)

Thanks,
Guy



--
Brian Coca

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8nzbkjUe1rrSKxVgA3cP6cj%3D0fpNrrN_FE_AVWw8g190g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages