Hoping for a hand with this, I haven't been able to get the logic right.
I have the following YAML list:
desktop_users:
- name: admin1
state: present
full_name: Admin 1
groups: [sudo]
- name: admin2
state: present
full_name: Admin 2
groups: []
- name: paul
state: present
full_name: Paul
groups: [kids]
locked: true
- name: munin
state: present
full_name: Munin
groups: [sudo, kids]
locked: false
I'm trying to extact a list of kids' account names, i.e. list of users that have 'kids' in their groups attribute (which is itself a list). For the above data, the desired outcome is to produce the following list to work with:
['paul','munin']
I tried to fit this into map() and selectattr() approaches but couldn't figure out how to structure a test to evaluate inclusion of a value in a list.
- Darren