Fork me on GitHub
---
- name: jedi
  gather_facts: true
  no_log: false
  hosts: 127.0.0.1
  tasks:
  - name: My public ipv4 addresses
    debug: msg="{{ 'My ipv4 addresses is: ' + hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ipaddr('public') | join(', ') }}"