Skip to content

Instantly share code, notes, and snippets.

@eoldavix
Created September 16, 2019 07:58
Show Gist options
  • Select an option

  • Save eoldavix/05192f782f6dae654639f607b953d229 to your computer and use it in GitHub Desktop.

Select an option

Save eoldavix/05192f782f6dae654639f607b953d229 to your computer and use it in GitHub Desktop.
Ansible: Get AMI instance type of an AWS EC2 machine
- 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 }}"
@eoldavix
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment