Hello All,
Is it possible that we can reformat the json body completely using Ansible?
As of now i have used the python script to read the json data and then do the reformatting of the json. But i am interest to know if the Ansible can do itself.
NOTE: can’t use the template as the contain would be dynamic. So i need your opinion if this is even possible or not using Ansible or we need to use the script only for this?
Example:
INPUT JSON:
{
“access_control”: ,
“active”: true,
“channel_database_cleanup”: {
“enabled”: false
},
“client_side_hostkey”: {
“plain_hostkey”: {
“dsa_key”: null,
“enabled”: true,
“rsa_key”: {
“key”: “e5a58682-6189-4477-9415-67c1c9b20b0d”,
“meta”: {
“href”: “/api/configuration/private_keys/e5a58682-6189-4477-9415-67c1c9b20b0d”
}
}
},
“x509_hostkey”: {
“enabled”: false
}
},
“indexing”: {
“enabled”: true,
“policy”: {
“key”: “-50000”,
“meta”: {
“href”: “/api/configuration/policies/indexing/-50000”
}
},
“priority”: 3
},
“log_audit_trail_downloads”: true,
“name”: “Test”,
“network”: {
“clients”: [
“x.x.x.x/x”
],
“ports”: [
xx
],
“targets”: [
“x.x.x.x/x”
]
},
“override_log_level”: {
“enabled”: false
},
“policies”: {
“analytics_policy”: {
“key”: “437ba32f-e673-4070-b8da-6c40a6918598”,
“meta”: {
“href”: “/api/configuration/policies/analytics/437ba32f-e673-4070-b8da-6c40a6918598”
}
},
“archive_cleanup_policy”: null,
“audit_policy”: {
“key”: “78101850949e47437dd91d”,
“meta”: {
“href”: “/api/configuration/policies/audit_policies/78101850949e47437dd91d”
}
}
},
“rate_limit”: {
“enabled”: flse
}
}
OUTOUT JSON:
{
“access_control”: ,
“active”: true,
“channel_database_cleanup”: {
“enabled”: false
},
“client_side_hostkey”: {
“plain_hostkey”: {
“dsa_key”: null,
“enabled”: true,
“rsa_key”: {
“key”: “e5a58682-6189-4477-9415-67c1c9b20b0d”,
“meta”: {
“href”: “/api/configuration/private_keys/e5a58682-6189-4477-9415-67c1c9b20b0d”
}
}
},
“x509_hostkey”: {
“enabled”: false
}
},
“indexing”: {
“enabled”: true,
“policy”: -50000
},
“priority”: 3
},
“log_audit_trail_downloads”: true,
“name”: “Test”,
“network”: {
“clients”: [
“x.x.x.x/x”
],
“ports”: [
xx
],
“targets”: [
“x.x.x.x/x”
]
},
“override_log_level”: {
“enabled”: false
},
“policies”: {
“analytics_policy”: “437ba32f-e673-4070-b8da-6c40a691859”,
“archive_cleanup_policy”: null,
“audit_policy”: “78101850949e47437dd91d”
},
“rate_limit”: {
“enabled”: flse
}
}
Regards
Amit