I'm using the willshersystems.users role from ansible galaxy for creating users on ubuntu servers. Now that I've got it working consistently, I'm trying to set the state attribute based on whether the user should have access to a specific server given a list.
Is something like the below possible? My google fu seems to be failing me at the moment, any advice would be very appreciated!
vars:
user_servers:
user1:
- testing1
users:
- name: user1
groups: '{{ user_groups }}'
state: "{{ ( inventory_hostname_short in user_servers[self.name] ) | ternary('present','absent') }}"
roles:
- role: willshersystems.users