mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
401 B
YAML
17 lines
401 B
YAML
![]()
3 years ago
|
- set_fact:
|
||
|
result: "{{ fruits | groupby('enjoy') }}"
|
||
|
vars:
|
||
|
fruits:
|
||
|
- name: apple
|
||
|
enjoy: yes
|
||
|
- name: orange
|
||
|
enjoy: no
|
||
|
- name: strawberry
|
||
|
enjoy: yes
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- result == expected
|
||
|
vars:
|
||
|
expected: [[false, [{"enjoy": false, "name": "orange"}]], [true, [{"enjoy": true, "name": "apple"}, {"enjoy": true, "name": "strawberry"}]]]
|