Skip to content

Instantly share code, notes, and snippets.

@MatthewJDavis
Created June 7, 2020 16:51
Show Gist options
  • Select an option

  • Save MatthewJDavis/6f28b1a88f226bfc781ce2c200b05ea3 to your computer and use it in GitHub Desktop.

Select an option

Save MatthewJDavis/6f28b1a88f226bfc781ce2c200b05ea3 to your computer and use it in GitHub Desktop.
Get network public ip address
---
- hosts: localhost
gather_facts: false
tasks:
- name: Get the public IP address of the network.
uri:
url: https://api.ipify.org?format=json
method: Get
changed_when: false
register: public_ip
until: public_ip.status == 200
retries: 6
delay: 10
- name: Display the public IP address of the network.
debug:
msg: "{{ public_ip.json.ip }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment