如何从 ansible jinja2 模板访问字典变量?

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 }}"