ansible.builtin.ipify_facts (v2.9.27) — module

Retrieve the public IP of your internet gateway

| "added in version" 2.0 of ansible.builtin"

Authors: René Moser (@resmo)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Gather IP facts from ipify.org
- name: Get my public IP
  ipify_facts:
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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

Inputs

    
api_url:
    default: https://api.ipify.org/
    description:
    - URL of the ipify.org API service.
    - C(?format=json) will be appended per default.
    type: str

timeout:
    default: 10
    description:
    - HTTP connection timeout in seconds.
    type: int
    version_added: '2.3'
    version_added_collection: ansible.builtin

validate_certs:
    default: true
    description:
    - When set to C(NO), SSL certificates will not be validated.
    type: bool
    version_added: '2.4'
    version_added_collection: ansible.builtin

Outputs

ipify_public_ip:
  description: Public IP of the internet gateway.
  returned: success
  sample: 1.2.3.4
  type: str