ho variabile ho chiamato "rete" registrata in Ansible:Ansible: filtrare un elenco con i suoi attributi
{
"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"
}
]
}
}
E 'possibile ottenere l'indirizzo IP ("addr") con type = "galleggiante" fare qualcosa come questo?
- debug: var={{ network.addresses.private_man | filter type="fixed" | get "addr" }}
So che la sintassi è sbagliato, ma si ottiene l'idea.
È necessario installare" jmespath "prima di eseguire il filtro json_query. – ceving