Created
June 11, 2020 14:30
-
-
Save Kagee/78060dee9db1d5c8f9be1d4bd41ca1ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: loop test | |
gather_facts: no | |
hosts: localhost | |
vars: | |
- array_usage: | |
- id: 0 | |
usage: 89 | |
- id: 1 | |
usage: 70 | |
- id: 2 | |
usage: 24 | |
- id: 3 | |
usage: 33 | |
tasks: | |
- debug: | |
msg: "{{ array_usage }}" | |
- name: Set min cap | |
set_fact: | |
use_capacity: "{{ array_usage | map(attribute='usage') | list | min }}" | |
PLAY [loop test] ************************************************************************************************************************************************************************************************************************************************************************* | |
TASK [debug] ***************************************************************************************************************************************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": [ | |
{ | |
"id": 0, | |
"usage": 89 | |
}, | |
{ | |
"id": 1, | |
"usage": 70 | |
}, | |
{ | |
"id": 2, | |
"usage": 24 | |
}, | |
{ | |
"id": 3, | |
"usage": 33 | |
} | |
] | |
} | |
TASK [Set initial capacity fact] ********************************************************************************************************************************************************************************************************************************************************* | |
ok: [localhost] | |
TASK [debug] ***************************************************************************************************************************************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": [ | |
"24" | |
] | |
} | |
PLAY RECAP ******************************************************************************************************************************************************************************************************************************************************************************* | |
localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment