Created
September 16, 2019 07:58
-
-
Save eoldavix/05192f782f6dae654639f607b953d229 to your computer and use it in GitHub Desktop.
Ansible: Get AMI instance type of an AWS EC2 machine
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: all | |
| tasks: | |
| - name: Gathering Instance Type | |
| uri: | |
| url: http://169.254.169.254/latest/meta-data/instance-type | |
| return_content: yes | |
| register: curl | |
| - debug: | |
| msg: "The AMI instance type of {{ inventory_hostname }} is: {{ curl.content }}" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can also curl to the url to get the instance type from the shell:
curl http://169.254.169.254/latest/meta-data/instance-type