Get list of all roles for a particular machine

If you have a client and server role for a particular application, and in your infrastructure at least 1 host needs the server role applied, and all others need the client role applied, how can you do it in a maintainable way?

I think the best would be to apply client role to all hosts with a when condition that is false if the host has server in its list of roles. How can you get this list?

Posted Jun 24, 2021, 2:53 PM UTC

21
s_l_a_t_f_a_t_fish•

i assign roles only to groups of hosts. if thats the case it allows the use of:

when: "'server' not in group_names"

to filter out all systems that act as a server for this service.

im not sure if there is a way to determine which roles got installed on a system

1