How to random roles

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

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