here is the dubug output ec2-facts
“ec2”: {
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: 0,
“architecture”: “x86_64”,
“block_device_mappings”: [
{
“device_name”: “/dev/xvda”,
“ebs”: {
“attach_time”: “2019-03-21T18:28:03+00:00”,
“delete_on_termination”: true,
“status”: “attached”,
“volume_id”: “vol-xxxx”
}
}
],
“client_token”: “”,
“cpu_options”: {
“core_count”: 1,
“threads_per_core”: 1
},
“ebs_optimized”: false,
“ena_support”: true,
“hibernation_options”: {
“configured”: false
},
“hypervisor”: “xen”,
“image_id”: “ami-xxxx”,
“instance_id”: “i-xxx”,
“instance_type”: “t2.micro”,
“key_name”: “xxxxx”,
“launch_time”: “2019-03-21T18:28:03+00:00”,
“monitoring”: {
“state”: “disabled”
},
“network_interfaces”: [
{
“association”: {
“ip_owner_id”: “amazon”,
“public_dns_name”: “ec2-xxxxx.us-east-2.compute.amazonaws.com”,
“public_ip”: “xx.xx.xx.51”
},
“attachment”: {
“attach_time”: “2019-03-21T18:28:03+00:00”,
“attachment_id”: “eni-attach-xxxxxx”,
“delete_on_termination”: true,
“device_index”: 0,
“status”: “attached”
},
“description”: “”,
“groups”: [
{
“group_id”: “sg-xx”,
“group_name”: “xxxxxx”
}
],
“ipv6_addresses”: ,
“mac_address”: “xx:66:xx:77:d4:f4”,
“network_interface_id”: “eni-xxxxxxx”,
“owner_id”: “xxxxxx”,
“private_dns_name”: “ip-xxxxxxx8.us-east-2.compute.internal”,
“private_ip_address”: “1xxxxxx”,
“private_ip_addresses”: [
{
“association”: {
“ip_owner_id”: “amazon”,
“public_dns_name”: “ec2-xx-xxx-xxx-xx.us-east-2.compute.amazonaws.com”,
“public_ip”: "18.x.xx.xx
},
“primary”: true,
“private_dns_name”: “xxxxxx.us-east-2.compute.internal”,
“private_ip_address”: “xxxxxx”
}
],
“source_dest_check”: true,
“status”: “in-use”,
“subnet_id”: “subnet-xxxx”,
“vpc_id”: “vpc-xxxxx”
}
],
“placement”: {
“availability_zone”: “us-east-2c”,
“group_name”: “”,
“tenancy”: “default”
},
“private_dns_name”: “xxxxxxx.us-east-2.compute.internal”,
“private_ip_address”: “xxx.xx.xx.xx”,
“product_codes”: ,
“public_dns_name”: “xxxxxxx.us-east-2.compute.amazonaws.com”,
“public_ip_address”: “xx.xxx.44.51”,
“root_device_name”: “/dev/xvda”,
“root_device_type”: “ebs”,
“security_groups”: [
{
“group_id”: “sg-xxxx”,
“group_name”: “xxxxxx”
}
],
“source_dest_check”: true,
“state”: {
“code”: 64,
“name”: “stopping”
},
“state_reason”: {
“code”: “Client.UserInitiatedShutdown”,
“message”: “Client.UserInitiatedShutdown: User initiated shutdown”
},
“state_transition_reason”: “User initiated (2019-03-21 19:33:16 GMT)”,
“subnet_id”: “subnet-xxx”,
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-xxxx”
}
]
}
}
i want to use debug option in playbook to print only the public ip
ec2.instances.public_ip is not working
can anyone please help