我在Ansible中注册了一个名为“ network”的变量:
{
"addresses": {
"private_ext": [
{
"type": "fixed",
"addr": "172.16.2.100"
}
],
"private_man": [
{
"type": "fixed",
"addr": "172.16.1.100"
},
{
"type": "floating",
"addr": "10.90.80.10"
}
]
}
}
是否可以像这样通过type =“ floating”获取IP地址(“ addr”)?
- debug: var={{ network.addresses.private_man | filter type="fixed" | get "addr" }}
我知道语法错误,但是您明白了。