On this page
ipinfoio_facts - Retrieve IP geolocation facts of a host’s IP address
New in version 2.3.
Synopsis
- Gather IP geolocation facts of a host’s IP address using ipinfo.io API
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| http_agent | Default: 
        "ansible-ipinfoio-module/0.0.1"
         | 
      
        
        Set http user agent
         | 
     
| timeout | Default: 
        10
         | 
      
        
        HTTP connection timeout in seconds
         | 
     
Notes
Note
- Check http://ipinfo.io/ for more information
 
Examples
# Retrieve geolocation data of a host's IP address
- name: get IP geolocation data
  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.
| Fact | Returned | Description | 
|---|---|---|
| city  
        string
         | 
      
        
        City name
         Sample:
        
       
        Mountain View
         | 
     |
| country  
        string
         | 
      
        
        ISO 3166-1 alpha-2 country code
         Sample:
        
       
        US
         | 
     |
| hostname  
        string
         | 
      
        
        Domain name
         Sample:
        
       
        google-public-dns-a.google.com
         | 
     |
| ip  
        string
         | 
      
        
        Public IP address of a host
         Sample:
        
       
        8.8.8.8
         | 
     |
| loc  
        string
         | 
      
        
        Latitude and Longitude of the location
         Sample:
        
       
        37.3860,-122.0838
         | 
     |
| org  
        string
         | 
      
        
        organization's name
         Sample:
        
       
        AS3356 Level 3 Communications, Inc.
         | 
     |
| postal  
        string
         | 
      
        
        Postal code
         Sample:
        
       
        94035
         | 
     |
| region  
        string
         | 
      
        
        State or province name
         Sample:
        
       
        California
         | 
     
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Aleksei Kostiuk (@akostyuk)
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.6/modules/ipinfoio_facts_module.html