Hello
I faced a issue with items , i would like to get the value of Json vars.
But i can’t access/get the value.
I write this ansible script :
`
Hello
I faced a issue with items , i would like to get the value of Json vars.
But i can’t access/get the value.
I write this ansible script :
`
*Hello *
*I faced a issue with items , i would like to get the value of Json vars.*
*But i can't access/get the value.**I write this ansible script :*
---
# tasks file for ansible-f5- name: Define f5_environment vars
set_fact:
env_f5: "QLF"- name: Collect BIG-IP facts
bigip_facts:
server: "{{f5_infos[env_f5].bigip_server}}"
user: "{{f5_infos[env_f5].bigip_user}}"
password: "{{f5_infos[env_f5].bigip_password}}"
include: node
validate_certs: "false"
connection: local
register: bigip_fact_out
#delegate_to: localhost- debug: var=bigip_fact_out
- name: Debug Msg Node
debug:
msg: "I have : {{ node['/Common/10.70.40.74'].address }} : {{
node['/Common/10.70.40.74'].monitor_status }} : {{
node['/Common/10.70.40.74'].session_status }}"- name: Printing Node Item
shell: |
#> /tmp/test
echo "{{ item.address }}" | sed -e "s/\/Common\///g" >> /tmp/test
with_items: "{{node}}"*i would like to get the list of address IP , {{ node[i].address }} where
i means the loop items.*
<snip>
*if i can store/get the field "address": for each item in the file
/tmp/test it would be great .....*
I don't know where you get node variable from, but the node in bigip_fact_out is dictonary and not a list so you can do this
- copy:
dest: /tmp/test
content: |
{% for key, value in bigip_fact_out.ansible_facts.node | dictsort %}
{{ value.address }}
{% endfor %}