community.general.ipinfoio_facts module – Retrieve IP geolocation facts of a host’s IP address
Note
This module is part of the community.general collection (version 9.5.1).
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.ipinfoio_facts
.
Synopsis
Gather IP geolocation facts of a host’s IP address using ipinfo.io API
Parameters
Parameter |
Comments |
---|---|
Set http user agent Default: |
|
HTTP connection timeout in seconds Default: |
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
Check http://ipinfo.io/ for more information
Examples
# Retrieve geolocation data of a host's IP address
- name: Get IP geolocation data
community.general.ipinfoio_facts:
Returned Facts
Facts returned by this module are added/updated in the hostvars
host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
Key |
Description |
---|---|
City name Returned: success Sample: |
|
ISO 3166-1 alpha-2 country code Returned: success Sample: |
|
Domain name Returned: success Sample: |
|
Public IP address of a host Returned: success Sample: |
|
Latitude and Longitude of the location Returned: success Sample: |
|
organization’s name Returned: success Sample: |
|
Postal code Returned: success Sample: |
|
State or province name Returned: success Sample: |