Hi all,
With this script I can randomize any host:
Hi all,
With this script I can randomize any host:
Do you mean that you want to work through all the hosts in a random order?
If so, just shuffle the list, then work through the list in shuffled order.
Regards, K.
Are you trying to run the playbook on a list of randomized hosts except the first and 2nd host?
Maybe you can try
See the following for more details
https://docs.ansible.com/ansible/latest/user_guide/intro_patterns.html
Nop, the idea is to randomize all hosts.
For example,
POOL: host1 host2 host3
I randomize, host2 is chosen
I randomize again, but now host2 cannot be selected.
POOL: host1 host3
I randomize, host1 is chosen
POOL: host3
I randomize, host3 is chosen
Once all hosts are chosen I can start the pool again.
POOL: host1 host2 host3
Yes - so shuffle the pool, then use the first host from the pool for the first task, the second host from the pool for the second task, the third host from the pool for the third task and so on.
You can either specify the offset in the pool for each successive task, or slice the pool between tasks.
Regards, K.