�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l m Z d d
l
m Z d d l m Z d e f d � � YZ d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: ipify_facts
short_description: Retrieve the public IP of your internet gateway
description:
- If behind NAT and need to know the public IP of your internet gateway.
version_added: '2.0'
author:
- René Moser (@resmo)
options:
api_url:
description:
- URL of the ipify.org API service.
- C(?format=json) will be appended per default.
type: str
default: https://api.ipify.org/
timeout:
description:
- HTTP connection timeout in seconds.
type: int
default: 10
version_added: "2.3"
validate_certs:
description:
- When set to C(NO), SSL certificates will not be validated.
type: bool
default: yes
version_added: "2.4"
notes:
- Visit https://www.ipify.org to get more information.
s�
# Gather IP facts from ipify.org
- name: Get my public IP
ipify_facts:
# 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
sz
---
ipify_public_ip:
description: Public IP of the internet gateway.
returned: success
type: str
sample: 1.2.3.4
N( t
AnsibleModule( t fetch_url( t to_textt
IpifyFactsc B` s e Z d � Z d � Z RS( c C` s. t j j d � | _ t j j d � | _ d S( Nt api_urlt timeout( t modulet paramst getR R
( t self( ( sI /usr/lib/python2.7/site-packages/ansible/modules/net_tools/ipify_facts.pyt __init__N s c C` s� i d d 6} t d t d | j d d t d | j � \ } } | sg t j d d | j | j f � n t j t | j
� � � } | j d � | d <| S(
Nt ipify_public_ipR t urls ?format=jsont forceR
t msgs? No valid or no response from url %s within %s seconds (timeout)t ip( t NoneR R R t TrueR
t fail_jsont jsont loadsR
t readR ( R t resultt responset infot data( ( sI /usr/lib/python2.7/site-packages/ansible/modules/net_tools/ipify_facts.pyt runR s
1#( t __name__t
__module__R R"