I figured out.

I came with this:

*- hosts: "{{ (groups['foo'] | shuffle)[0:1] }}" * #THIS SCRIPT RANDOMS THE 
HOST
  become: true
  vars:
   - ansible_sudo_pass: *******
  roles:
   *- role: "{{ ['reboot','shutdown'] | random }}"*   #THIS SCRIPT RANDOMS 
THE ROLE

So I guess we can consider this issue solved.

Thanks anyways, guys

On Wednesday, January 2, 2019 at 11:53:44 AM UTC-2, Francis Santos wrote:
>
> I gotta random both the hosts and the roles.
> I successfully randomed the hosts, but I not getting the roles to random.
> Here is what I got
>
> ---
> - hosts: "{{ (groups['foo'] | shuffle)[0:1] }}"
>   become: yes
>   vars:
>    - ansible_sudo_pass: ******
>   roles:  
>    - reboot  #one of the roles are reboot, but there are a few more and 
> must be randomized
>
> Any suggestions?
> -- 
>
> Atenciosamente/ Regards/ Mit freundlichen Grüßen
>
>
> *_________________________________ **Frank Santos*
>
> Phone:
> [email protected] <[email protected]>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/36faec7d-1b95-4640-8571-f3c8557dec92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to