Re: [ansible-project] Re: How to randomize hosts but not repeat the ones that already were selected

2019-01-09 Thread Karl Auer
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

Re: [ansible-project] Re: How to randomize hosts but not repeat the ones that already were selected

2019-01-09 Thread Francis Santos
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

[ansible-project] Re: How to randomize hosts but not repeat the ones that already were selected

2019-01-09 Thread Tony Chia
Are you trying to run the playbook on a list of randomized hosts except the first and 2nd host? Maybe you can try - hosts: "{{ (groups['all'] | shuffle)[2:] }}" See the following for more details https://docs.ansible.com/ansible/latest/user_guide/intro_patterns.html On Wednesday, January 9, 2