Hope you are fine.
I am still in trouble with looping over ansible 2.9 facts despites my search on web and documentation.
I woul like to retrieve ip address from custom interfaces on all hosts and put in a list. This is what i tried:
---
- hosts: all
gather_facts: True
vars:
ip_private_list: []
- set_fact:
ip_private_list: "{{ ip_private_list + [item] }}"
with_items: "{{ hostvars[inventory_hostname]['ansible_ens256']['ipv4']['address'] }}"
delegate_facts: true
I don't understand why ip_private_list is not populated with elements and when i try to debug with msg i get "Ansible Undefined"
Is there anything i miss about data structure or the right way to do it ?
Thans for you help