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

On Wed, Jan 9, 2019 at 12:45 PM Tony Chia <tchi...@gmail.com> wrote:

> 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, 2019 at 5:49:56 AM UTC-8, Francis Santos wrote:
>>
>> Hi all,
>>
>> With this script I can randomize any host:
>>
>> ---
>>
>> - hosts: "{{ (groups['all'] | shuffle)[0:1] }}"
>>   become: true
>>   vars:
>>    - ansible_sudo_pass: ****
>>
>> How can I add the proposition to skip the ones that were selected? So I
>> can use the whole pool of hosts before selecting them again.
>>
>>
>> --
> 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-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/22d17f59-2a99-42ff-9064-f6c72c20dc93%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/22d17f59-2a99-42ff-9064-f6c72c20dc93%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Atenciosamente/ Regards/ Mit freundlichen Grüßen


*_________________________________ **Frank Santos*

Phone: +55 11 996001909
skaven...@gmail.com <skaven...@outlook.com>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAnOJNYfRmwDPK_1F8zOd%2BNDQ4HsC9%2BXOheCmm8gBM1ZLYG%2BEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to