Hi,

Need help to fetch output from the below output message.

Bascially I need to extract "packet_loss", "packets_rx", "packets_tx", 
"rtt_avg", "rtt_max" & "rtt_min" for each "item".

Trying to use the code as

Code
=============:
- debug:
    var: "{{ item['packet_loss'] }}"
  with_items: "{{ output.results }}"
=============

Output:
=============
"results": [
{
"_ansible_ignore_errors": null,
"_ansible_item_label": {
"count": 5,
"dst": "192.168.1.3",
"packet_loss": null,
"packets_rx": null,
"packets_tx": null,
"rtt_avg": null,
"rtt_max": null,
"rtt_min": null,
"source": "192.168.1.1"
},
"_ansible_item_result": true,
"_ansible_no_log": false,
"_ansible_parsed": true,
"changed": false,
"commands": [
"ping 192.168.1.3 count 5 source 192.168.1.1"
],
"failed": false,
"invocation": {
"module_args": {
"auth_pass": null,
"authorize": null,
"count": "5",
"dest": "192.168.1.3",
"host": null,
"password": null,
"port": null,
"provider": null,
"source": "192.168.1.1",
"ssh_keyfile": null,
"state": "present",
"timeout": null,
"transport": null,
"use_ssl": null,
"username": null,
"validate_certs": null,
"vrf": null
}
},
"item": {
"count": 5,
"dst": "192.168.1.3",
"packet_loss": null,
"packets_rx": null,
"packets_tx": null,
"rtt_avg": null,
"rtt_max": null,
"rtt_min": null,
"source": "192.168.1.1"
},
"packet_loss": "0.00%",
"packets_rx": 5,
"packets_tx": 5,
"rtt": {
"avg": 0.67,
"max": 0.876,
"min": 0.585
}
},
{
"_ansible_ignore_errors": null,
"_ansible_item_label": {
"count": "N/A",
"dst": "N/A",
"packet_loss": null,
"packets_rx": null,
"packets_tx": null,
"rtt_avg": null,
"rtt_max": null,
"rtt_min": null,
"source": "N/A"
},
"_ansible_item_result": true,
"_ansible_no_log": false,
"changed": false,
"item": {
"count": "N/A",
"dst": "N/A",
"packet_loss": null,
"packets_rx": null,
"packets_tx": null,
"rtt_avg": null,
"rtt_max": null,
"rtt_min": null,
"source": "N/A"
},
"skip_reason": "Conditional result was False",
"skipped": true
},
{
"_ansible_ignore_errors": null,
"_ansible_item_label": {
"count": "N/A",
"dst": "N/A",
"packet_loss": null,
"packets_rx": null,
"packets_tx": null,
"rtt_avg": null,
"rtt_max": null,
"rtt_min": null,
"source": "N/A"
},
"_ansible_item_result": true,
"_ansible_no_log": false,
"changed": false,
"item": {
"count": "N/A",
"dst": "N/A",
"packet_loss": null,
"packets_rx": null,
"packets_tx": null,
"rtt_avg": null,
"rtt_max": null,
"rtt_min": null,
"source": "N/A"
},
"skip_reason": "Conditional result was False",
"skipped": true
},
{
"_ansible_ignore_errors": null,
"_ansible_item_label": {
"count": "N/A",
"dst": "N/A",
"packet_loss": null,
"packets_rx": null,
"packets_tx": null,
"rtt_avg": null,
"rtt_max": null,
"rtt_min": null,
"source": "N/A"
},
"_ansible_item_result": true,
"_ansible_no_log": false,
"changed": false,
"item": {
"count": "N/A",
"dst": "N/A",
"packet_loss": null,
"packets_rx": null,
"packets_tx": null,
"rtt_avg": null,
"rtt_max": null,
"rtt_min": null,
"source": "N/A"
},
"skip_reason": "Conditional result was False",
"skipped": true
==================

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c6b832fd-47e8-4a10-87a4-1ef6aa868f02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to