Filter based on attribute
This is very useful for selecting data from a very large list. For instance, if you have a very lost list of users and you only want to apply a task for users in the group admins. This is war more time efficient, than looping over the complete list, skipping over 99% of the items.
adminlist = "{{ user_list | selectattr('group', 'defined') | selectattr('group', 'equalto', 'admin') }}"
No Comments