API Call output via Ansible URI Module Not Getting the Complete Output

Hi Team,

I have a small playbook which connects to InfoBlox Server and collects useful data via API and then save API commands out to variable and later redirecting variable output to a log file.

Issue is that Variable is not getting all output but it captures only fraction of output. Any idea and suggestion how to capture complete output of API call and save it in log file in formatted way , just like Jason

Below is playbook:

Have a look at the return_content parameter of the uri module

Thank You Very Much, it resolves my output capture issue.

Now content is saved in log file with the following format, is there any way to format that data while saving it a file. As you can see in the output below, in place of new line \n is printed.

{‘content’: '{\n “result”: [\n {\n “_ref”: "member/bxxxxxxxxxxxxxx, \n “config_addr_type”: “IPV4”, \n “host_name”: “xxxxxxxxxxxxxxxxxxxxxx”, \n “node_info”: [\n {\n “ha_status”: “NOT_CONFIGURED”, \n “hwid”: “892A5BA7A1CB4AA9BEAB99A3ECC81116”, \n “hwmodel”: “”, \n “hwplatform”: “KVM”, \n “hwtype”: “IB-V825”, \n “lan2_physical_setting”: {\n “auto_port_setting_enabled”: true\n }, \n “lan_ha_port_setting”: {\n “ha_port_setting”: {\n “auto_port_setting_enabled”: true, \n “speed”: “10”\n }, \n “lan_port_setting”: {\n “auto_port_setting_enabled”: true\n }\n }, \n “mgmt_network_setting”: {\n “address”: “xxxxxxx”, \n “gateway”: “xxxxxxxx”, \n “subnet_mask”: “255.255.255.248”\n }, \n “mgmt_physical_setting”: {\n “auto_port_setting_enabled”: true\n }, \n “paid_nios”: false, \n “physical_oid”: “0”, \n “service_status”: [\n {\n “description”: “Running”, \n “service”: “NODE_STATUS”, \n “status”: “WORKING”\n }, \n {\n “description”: “2% - Primary drive usage is OK.”, \n “service”: “DISK_USAGE”, \n “status”: “WORKING”\n }, \n {\n “description”: “10.250.169.140”, \n “service”: “ENET_LAN”, \n “status”: “WORKING”\n }, \n {\n “description”: “xxxxxxx”, \n “service”: “ENET_LAN2”, \n “status”: “WORKING”\n }, \n {\n “description”: “10.250.169.132”, \n “service”: “ENET_MGMT”, \n “status”: “WORKING”\n }, \n {\n “description”: "3% - Data

Hi pardeep,

You can use filter module of ansible to get ouput in from of yaml or json

Best regards,
Vivek

Thanks Vivek, your suggestion was very helpful and it resolves formatting issue