Created
June 7, 2020 16:51
-
-
Save MatthewJDavis/6f28b1a88f226bfc781ce2c200b05ea3 to your computer and use it in GitHub Desktop.
Get network public ip address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - 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