Hi Filip,
You can run the EC2 inventory file and list out all variables for a host by doing this:
$ /etc/ansible/hosts --host ec2-50-112-79-155.us-west-2.compute.amazonaws.com
{
“ec2__in_monitoring_element”: false,
“ec2__previous_state”: “”,
“ec2_ami_launch_index”: “0”,
“ec2_architecture”: “x86_64”,
“ec2_client_token”: “d79a7c98-10f7-4b3e-be3d-426098331041”,
“ec2_dns_name”: “ec2-50-112-79-155.us-west-2.compute.amazonaws.com”,
“ec2_ebs_optimized”: false,
“ec2_eventsSet”: “”,
“ec2_group_name”: “”,
“ec2_hypervisor”: “xen”,
“ec2_id”: “i-b2c51888”,
“ec2_image_id”: “ami-ca1582fa”,
“ec2_instance_profile”: “”,
“ec2_instance_type”: “m1.xlarge”,
“ec2_ip_address”: “50.112.79.155”,
“ec2_item”: “”,
“ec2_kernel”: “aki-ace26f9c”,
“ec2_key_name”: “secretkey”,
“ec2_launch_time”: “2013-05-03T00:01:39.000Z”,
“ec2_monitored”: false,
“ec2_monitoring”: “”,
“ec2_persistent”: false,
“ec2_platform”: “”,
“ec2_private_dns_name”: “ip-10-253-43-92.us-west-2.compute.internal”,
“ec2_private_ip_address”: “10.253.43.92”,
“ec2_public_dns_name”: “ec2-50-112-79-155.us-west-2.compute.amazonaws.com”,
“ec2_ramdisk”: “”,
“ec2_reason”: “”,
“ec2_region”: “us-west-2”,
“ec2_requester_id”: “”,
“ec2_root_device_name”: “”,
“ec2_root_device_type”: “instance-store”,
“ec2_security_group_ids”: “sg-5b4e0b6b”,
“ec2_security_group_names”: “ElasticMapReduce-slave”,
“ec2_spot_instance_request_id”: “”,
“ec2_state_reason”: “”,
“ec2_subnet_id”: “”,
“ec2_tag_Name”: “EMR Cluster”,
“ec2_tag_aws_elasticmapreduce_instance-group-role”: “CORE”,
“ec2_tag_aws_elasticmapreduce_job-flow-id”: “j-122MBJ5QTIUJ1”,
“ec2_virtualization_type”: “paravirtual”,
“ec2_vpc_id”: “”
}
So in this case, ec2_ip_address is the variable for the public IP
Hope that helps.
Peter Sankauskas