我在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"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
是否有可能获得类型="浮动"的IP地址("addr")做这样的事情?
- debug: var={{ network.addresses.private_man | filter type="fixed" | get "addr" }}
Run Code Online (Sandbox Code Playgroud)
我知道语法错了,但你明白了.