![](/img/trans.png)
[英]Loop over Ansible variable array in Jinja2 template to create nested dictionary
[英]How to acces dictionary variable from ansible jinja2 templates?
我想从Dict列表访问size_available变量
"ansible_mounts": [
{
"device": "/dev/sda1",
"fstype": "ext4",
"mount": "/",
"options": "rw,errors=remount-ro",
"size_available": 15032406016,
"size_total": 20079898624
}
]
- action: debug msg="mem= {{ ansible_mounts.size_available }}"
任务[调试] ************************************************** *********************
fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "'list' object has no attribute 'size_available'"}
能否请您检查一下,没有测试一下:
- action: debug msg="mem= {{ ansible_mounts[0].size_available }}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.