Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
Ansible tips & tricksAnsible data typesinteger: 3211241boolean: true/false float: 3.141592653 string: "qwerty" list: - "item 1" - "item 2" dictionary: key1: "value 1" key2: "value 2" manipulating dataExtract subitems from list of dictionariesUse "{{ variable | map(attribute='keyname') | list }}"Select items from list of dictionariesUse "{{ variable | selectattr('keyname', 'match', 'value') | list }}" Instead of match, you can also use search or regex. See: https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#testing-stringsSort list of dictionaries by subitemUse "{{ variable | sort(attribute='keyname') }}" -- Ivo van Geel - 21 Sep 2021 |