Created
June 11, 2020 14:35
-
-
Save Kagee/cd5aab62f1db66a6f7c28f2b33d3201e 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 }}" | |
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
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