ipify_facts - Retrieve the public IP of your internet gateway.

New in version 2.0.

Synopsis

  • If behind NAT and need to know the public IP of your internet gateway.

Options

parameter required default choices comments
api_url
no https://api.ipify.org
URL of the ipify.org API service.
?format=json will be appended per default.
timeout
(added in 2.3)
no 10
HTTP connection timeout in seconds.
validate_certs
(added in 2.4)
no yes
When set to NO, SSL certificates will not be validated.

Examples

# Gather IP facts from ipify.org
- name: get my public IP
  ipify_facts:

# Gather IP facts from your own ipify service endpoint with a custom timeout
- name: get my public IP
  ipify_facts:
    api_url: http://api.example.com/ipify
    timeout: 20

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
ipify_public_ip
Public IP of the internet gateway.
success string 1.2.3.4

Notes

Note

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/ipify_facts_module.html