{"body":"- name: Gather address fact\n  set_fact:\n    # NOTE(cloudnull):\n    #  Collect the interface address from hostvars of a target node.\n    #  Check if the host is running in a container. If not, pull the bridge data from the\n    #  network interface. If an interface bridge is defined, pull the IP address from the\n    #  physical network device. If no physical bridge is defined collect the address from\n    #  the \"<INTERFACE>_network_data\" variable. If nothing is defined use the\n    #  \"ansible_host\" address.\n    _lookup_address: >-\n      {%- set _network_data = hostvars[inventory_hostname]['container_networks'][network_address] | default({}) -%}\n      {%- if is_metal is defined and is_metal | bool -%}\n      {%-   set _bridge = _network_data['bridge'] | default('no_bridge_defined') | replace('-', '_') -%}\n      {%- else -%}\n      {%-   set _bridge = 'no_bridge_defined' -%}\n      {%- endif -%}\n      {%- if _bridge != 'no_bridge_defined' and hostvars[inventory_hostname]['ansible_' + _bridge]['ipv4'] is defined-%}\n      {{  hostvars[inventory_hostname]['ansible_' + _bridge]['ipv4']['address'] }}\n      {%- elif _network_data['address'] is defined -%}\n      {{ _network_data['address'] }}\n      {%- else -%}\n      {{ ansible_ssh_host }}\n      {%- endif -%}\n  tags:\n    - always\n","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/A1AZHhhA","modified":1496321630,"id":"A1AZHhhA","size":1287,"lines":25,"own_paste":false,"theme":"","date":1496321630}