I need to list the target host's name and IP address using set_fact. Below is my playbook, but it's giving error.
hosts: all tasks: - set_fact: data: "{{ ansible_all_ipv4_addresses }}" - set_fact: ip: "{{ data.split(',') }}" - name: Show the devices shell: echo {{ item }} >> /tmp/ips with_items: "{{ blockdevices }}" Desired o/p is host1 : 172.168.1.21 system2: 172.168.1.22 Anybody help me to fix this pls ? thanks in advance -- 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/f8418add-dc52-4310-bf26-c081b2f56348%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.