I have 8 servers as(s1,s2,s3...)which are windows servers and an ansible-playbook with tasks in roles. How do I configure host inventory and execute all these tasks in s1 then in s2 then in S3...sequentially that is the execution of the playbook in series of servers sequentially. I came across some terminology called serial but not sure on implementation The deployment will be carried using Jenkins. Any suggestions would be helpful Thanks in advance
Asked
Active
Viewed 778 times
1 Answers
1
To do a set of roles to completion on one host at a time, set serial: 1
on plays. These batch sizes can be numbers or percentages.
By default hosts are run in the order they appear in inventory, which would be order: inventory
on the play. Or, you can use alphanumeric collation order with order: sorted
.

John Mahowald
- 32,050
- 2
- 19
- 34
-
I'm using ansible roles and the command I use is like this ansible-playbook main.yml --tags 'build-job'. Where do I add serial? Can youplease help on this? – vodevops Jan 21 '21 at 08:11
-
I added serial:1 but the playbook is taking 2nd hosts initially. like I have 2 hosts [werservers] host1 host2 the order of execution must be host1 --------- host2-------- but the execution is on host2 initially then host1. i have given as order: sorted but the execution is same – vodevops Jan 21 '21 at 09:35
-
Probably you want `order: inventory` so the inventory defines how it is sorted. Review `ansible-inventory --list` with this inventory config, and confirm it is sorted in the correct order. – John Mahowald Jan 21 '21 at 15:35