--- - hosts: o25.oopen.de tasks: - name: debug print all interface ipv4 data when: "hostvars[ansible_fqdn]['ansible_'~item]['ipv4'] is defined" debug: msg="{{ hostvars[ansible_fqdn]['ansible_'~item]['ipv4'] | pprint }}" with_items: - "{{ ansible_interfaces | map('replace', '-','_') | list }}" - name: define traditional ethernet facts set_fact: ansible_eth: "{% set ansible_eth = ansible_eth|default([]) + [hostvars[inventory_hostname]['ansible_' + item]] %}{{ ansible_eth|list }}" when: hostvars[inventory_hostname]['ansible_' + item]['type'] == 'ether' with_items: - "{{ hostvars[inventory_hostname]['ansible_interfaces'] }}"