如果 json key 名称中包含破折号,Ansible playbook 将无法工作,如果没有破折号,则可以正常工作。
我尝试使用 from_json 和 json_query,但遇到了同样的问题
这是我必须解析的输出:
ok: [2.2.2.2] => {
"bgp": {
"response": {
"@status": "success",
"result": {
"entry": [
{
"@peer": "V4",
"@vr": "VR",
"ORF-entry-received": "0",
"aggregate-confed-as": "yes",
"config": {
"remove-private-as": "yes"
},
"connect-retry-interval": "15",
"established-counts": "0",
"holdtime": "0",
"holdtime-config": "90",
"idle-hold": "15",
"keepalive": "0",
"keepalive-config": "30",
"last-error": null,
"last-update-age": "634",
"local-address": "3.3.3.3",
"msg-total-in": "0",
"msg-total-out": "0",
"msg-update-in": "0",
"msg-update-out": "0",
"multi-hop-ttl": "1",
"nexthop-peer": "no",
"nexthop-self": "no",
"nexthop-thirdparty": "yes",
"open-delay": "0",
"passive": "no",
"password-set": …Run Code Online (Sandbox Code Playgroud) ansible ×1