community.general.ipify_facts module – Retrieve the public IP of your internet gateway
Note
This module is part of the community.general collection (version 5.8.3).
You might already have this collection installed if you are using the ansible
package.
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:
|
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: |
Collection links
Issue Tracker Repository (Sources) Submit a bug report Request a feature Communication