community.general.ipify_facts module – Retrieve the public IP of your internet gateway
Note
This module is part of the community.general collection (version 9.4.0).
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.ipify_facts
.
Synopsis
If behind NAT and need to know the public IP of your internet gateway.
Parameters
Parameter |
Comments |
---|---|
URL of the ipify.org API service.
Default: |
|
HTTP connection timeout in seconds. Default: |
|
When set to Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full This action does not modify state. |
Can run in |
|
Support: N/A This action does not modify state. |
Will return details on what has changed (or possibly needs changing in |
|
Support: full |
Action returns an |
Notes
Note
Visit https://www.ipify.org to get more information.
Examples
# Gather IP facts from ipify.org
- name: Get my public IP
community.general.ipify_facts:
# Gather IP facts from your own ipify service endpoint with a custom timeout
- name: Get my public IP
community.general.ipify_facts:
api_url: http://api.example.com/ipify
timeout: 20
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Public IP of the internet gateway. Returned: success Sample: |