Difference: AnsibleTipsTricks (18 vs. 19)

Revision 1905 Jul 2023 - IvoVanGeel

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Ansible tips & tricks

Line: 121 to 121
 

Select items from list of dictionaries

Use "{{ variable | selectattr('key_name', 'match', 'value') | list }}"

Added:
>
>
Instead of selectattr, you can also use rejectattr.
  Instead of match, you can also use search or regex. See: https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#testing-strings
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2010-2019 by LANIS