ansible loop iteration on result

Hello All,

I am trying to get ip address from ec2_fact.

So I have lists of tags. on the basis of tags, i am searching the ec2 using the ec2_fact module and storing the result in the register variable.

I am trying to get the ip address which from the register variable, I am not able to get. Can you please help me which i am doing wrong ?

here is code

`
Enter code here…

  • name: Task | get ec2 remote facts of instances
    `
    ec2_remote_facts:
    aws_secret_key: “{{ session_secret_key }}”
    aws_access_key: “{{ session_access_key }}”
    security_token: “{{ session_security_token }}”
    region: “{{ aws_region }}”
    filters:
    instance-state-name: running
    “tag:Name”: “{{ site_id }}*-{{ item.0 }}”
    “tag:teradata:type”: “{{ item.1 }}”
    register: stack_metadata
    ignore_errors: yes
    with_together:

  • “{{ inventory_search_tag }}”

  • “{{ inventory_search_tag_type }}”

  • debug: var=“{{ item.instances[0].private_ip_address }}”
    with_items: “{{ stack_metadata.results }}”

here is the result

`

ok: [localhost] => {
“stack_metadata”: {
“changed”: false,
“msg”: “All items completed”,
“results”: [
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: “0”,
“architecture”: “x86_64”,
“block_device_mapping”: [
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbx”,
“status”: “attached”,
“volume_id”: “vol-003a86fc21a79d6de”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbs”,
“status”: “attached”,
“volume_id”: “vol-03d179813b791f975”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbr”,
“status”: “attached”,
“volume_id”: “vol-0ba220c9c6b283445”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbq”,
“status”: “attached”,
“volume_id”: “vol-0bb0c210af73393fd”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbp”,
“status”: “attached”,
“volume_id”: “vol-0c22ddab4d0f9e8b9”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbw”,
“status”: “attached”,
“volume_id”: “vol-01f2572a1c5b36bf7”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbv”,
“status”: “attached”,
“volume_id”: “vol-09106be4cf4e4e5ca”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbu”,
“status”: “attached”,
“volume_id”: “vol-0af704139d5747e2b”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbt”,
“status”: “attached”,
“volume_id”: “vol-0d3248aefb98073e5”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbk”,
“status”: “attached”,
“volume_id”: “vol-004e2209a4f9574be”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbj”,
“status”: “attached”,
“volume_id”: “vol-091cd18293c7619d7”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbi”,
“status”: “attached”,
“volume_id”: “vol-023d345832f1b03e1”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbh”,
“status”: “attached”,
“volume_id”: “vol-05578407d58aba468”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbo”,
“status”: “attached”,
“volume_id”: “vol-0b047dcccbe6c185f”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbn”,
“status”: “attached”,
“volume_id”: “vol-0b026749c6ef82c58”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbm”,
“status”: “attached”,
“volume_id”: “vol-015822ffee0c3ddbc”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbl”,
“status”: “attached”,
“volume_id”: “vol-026c0772829e762e7”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbc”,
“status”: “attached”,
“volume_id”: “vol-0eb5e378abe1a2afa”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbb”,
“status”: “attached”,
“volume_id”: “vol-0169bfa7391bc37b2”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdba”,
“status”: “attached”,
“volume_id”: “vol-09c96b4e3e547e8c0”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbg”,
“status”: “attached”,
“volume_id”: “vol-0d61fd46418a0e2cf”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbf”,
“status”: “attached”,
“volume_id”: “vol-0b0a3a630ba41470c”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbe”,
“status”: “attached”,
“volume_id”: “vol-01a053994b60ad93b”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdbd”,
“status”: “attached”,
“volume_id”: “vol-0ba45913958ded57c”
},
{
“attach_time”: “2019-02-11T15:33:45.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/sda1”,
“status”: “attached”,
“volume_id”: “vol-0a24f020961fe0458”
}
],
“client_token”: “8995a374-c528-7879-4b0c-994ae09473cb_subnet-e36e71be_2”,
“ebs_optimized”: false,
“groups”: [
{
“id”: “sg-0f09d92b5246d1513”,
“name”: “test643-test-CICD-test-E9QBX54LAI3S”
},
{
“id”: “sg-07f1b94efcc80297a”,
“name”: “test643-test-CICD-test-RGFU7R8EIH79”
}
],
“hypervisor”: “xen”,
“id”: “i-08821240a85ace9e7”,
“image_id”: “ami-abcd4321123”,
“instance_profile”: {
“arn”: “arn:aws:iam::xxxxxxxxxxx:instance-profile/test643-test-CICD-test-1OM9KR7Q2K2H0”,
“id”: “AIPAJVZ2QBN35CYV2CEMO”
},
“interfaces”: [
{
“id”: “eni-0af11c7b789d2f6a6”,
“mac_address”: “0e:8e:b3:0d:96:46”
}
],
“kernel”: null,
“key_name”: “test-customer-nodes”,
“launch_time”: “2019-02-11T15:33:43.000Z”,
“monitoring_state”: “enabled”,
“persistent”: false,
“placement”: {
“tenancy”: “default”,
“zone”: “us-west-1a”
},
“private_dns_name”: “ip-10-52-2-43.ec2.internal”,
“private_ip_address”: “10.52.2.43”,
“public_dns_name”: “”,
“public_ip_address”: null,
“ramdisk”: null,
“region”: “us-west-1”,
“requester_id”: null,
“root_device_type”: “ebs”,
“source_destination_check”: “true”,
“spot_instance_request_id”: null,
“state”: “running”,
“tags”: {
“Name”: “test643-test-CICD-SMP001-01”,
“aws:autoscaling:groupName”: “test643-test-CICD-DBAutoscalingGroup-1W2ZCDKL348OV”,
“aws:cloudformation:logical-id”: “DBAutoscalingGroup”,
“aws:cloudformation:stack-id”: “arn:aws:cloudformation:us-west-1:xxxxxxxxxxx:stack/test643-test-CICD/05ea4900-2e12-11e9-8d3f-0e17762a99e0”,
“aws:cloudformation:stack-name”: “test643-test-CICD”,
“test:stack”: “test643-test-CICD”,
“test:type”: “tpa”
},
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-12345678”
}
],
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-SMP001-01”,
“tag:test:type”: “tpa”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“SMP001-01”,
“tpa”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: ,
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-test”,
“tag:test:type”: “vp”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“test”,
“vp”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: “0”,
“architecture”: “x86_64”,
“block_device_mapping”: [
{
“attach_time”: “2019-02-11T15:31:48.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/sda1”,
“status”: “attached”,
“volume_id”: “vol-06a28ac3d786b38fc”
},
{
“attach_time”: “2019-02-11T15:31:48.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdcb”,
“status”: “attached”,
“volume_id”: “vol-0469dbd36679051f2”
},
{
“attach_time”: “2019-02-11T15:31:48.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdca”,
“status”: “attached”,
“volume_id”: “vol-05efc2f37686d5db6”
}
],
“client_token”: “TDUPA-testIn-1S8VU7S4CDQMX”,
“ebs_optimized”: false,
“groups”: [
{
“id”: “sg-031e2f6579c2fd128”,
“name”: “test643-test-CICD-test-1B4SQ57VW6JYI”
},
{
“id”: “sg-07f1b94efcc80297a”,
“name”: “test643-test-CICD-test-RGFU7R8EIH79”
}
],
“hypervisor”: “xen”,
“id”: “i-6a8a3d653d8”,
“image_id”: “ami-abcd4321123”,
“instance_profile”: null,
“interfaces”: [
{
“id”: “eni-897b0049b9f”,
“mac_address”: “0e:28:dd:b6:f7:8a”
}
],
“kernel”: null,
“key_name”: “test-customer-nodes”,
“launch_time”: “2019-02-11T15:31:48.000Z”,
“monitoring_state”: “disabled”,
“persistent”: false,
“placement”: {
“tenancy”: “default”,
“zone”: “us-west-1a”
},
“private_dns_name”: “ip-10-52-1-156.ec2.internal”,
“private_ip_address”: “10.52.1.156”,
“public_dns_name”: “”,
“public_ip_address”: null,
“ramdisk”: null,
“region”: “us-west-1”,
“requester_id”: null,
“root_device_type”: “ebs”,
“source_destination_check”: “true”,
“spot_instance_request_id”: null,
“state”: “running”,
“tags”: {
“Name”: “test643-test-CICD-test”,
“aws:cloudformation:logical-id”: “testInstance”,
“aws:cloudformation:stack-id”: “arn:aws:cloudformation:us-west-1:xxxxxxxxxxx:stack/test643-test-CICD/05ea4900-2e12-11e9-8d3f-0e17762a99e0”,
“aws:cloudformation:stack-name”: “test643-test-CICD”,
“test:stack”: “test643-test-CICD”,
“test:type”: “test”
},
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-12345678”
}
],
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-test”,
“tag:test:type”: “test”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“test”,
“test”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: “0”,
“architecture”: “x86_64”,
“block_device_mapping”: [
{
“attach_time”: “2019-02-11T15:31:51.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/sda1”,
“status”: “attached”,
“volume_id”: “vol-04fcb3637e231695b”
}
],
“client_token”: “TDUPA-testIns-1SYZP0PVLB60U”,
“ebs_optimized”: false,
“groups”: [
{
“id”: “sg-0a96bb98b499bd560”,
“name”: “test643-test-CICD-test-1K390UGZ9016A”
},
{
“id”: “sg-07f1b94efcc80297a”,
“name”: “test643-test-CICD-test-RGFU7R8EIH79”
}
],
“hypervisor”: “xen”,
“id”: “i-033619edf6ec”,
“image_id”: “ami-abcd4321123”,
“instance_profile”: null,
“interfaces”: [
{
“id”: “eni-03110c79097”,
“mac_address”: “0e:c0:a3:ac:ab:76”
}
],
“kernel”: null,
“key_name”: “test-customer-nodes”,
“launch_time”: “2019-02-11T15:31:50.000Z”,
“monitoring_state”: “disabled”,
“persistent”: false,
“placement”: {
“tenancy”: “default”,
“zone”: “us-west-1a”
},
“private_dns_name”: “ip-10-52-2-225.ec2.internal”,
“private_ip_address”: “10.52.2.225”,
“public_dns_name”: “”,
“public_ip_address”: null,
“ramdisk”: null,
“region”: “us-west-1”,
“requester_id”: null,
“root_device_type”: “ebs”,
“source_destination_check”: “true”,
“spot_instance_request_id”: null,
“state”: “running”,
“tags”: {
“Name”: “test643-test-CICD-test-Manager”,
“aws:cloudformation:logical-id”: “testInstance”,
“aws:cloudformation:stack-id”: “arn:aws:cloudformation:us-west-1:xxxxxxxxxxx:stack/test643-test-CICD/05ea4900-2e12-11e9-8d3f-0e17762a99e0”,
“aws:cloudformation:stack-name”: “test643-test-CICD”,
“test:stack”: “test643-test-CICD”,
“test:type”: “testm”
},
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-12345678”
}
],
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-test-Manager”,
“tag:test:type”: “testm”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“test-Manager”,
“testm”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: “0”,
“architecture”: “x86_64”,
“block_device_mapping”: [
{
“attach_time”: “2019-02-11T15:31:51.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/sda1”,
“status”: “attached”,
“volume_id”: “vol-07c69b47ab21c9a85”
}
],
“client_token”: “TDUPA-RESTI-1XQH5HNSMY7BE”,
“ebs_optimized”: false,
“groups”: [
{
“id”: “sg-0c2981a1139af53a2”,
“name”: “test643-test-CICD-test-ND3Q4FMU1KDA”
},
{
“id”: “sg-07f1b94efcc80297a”,
“name”: “test643-test-CICD-test-RGFU7R8EIH79”
}
],
“hypervisor”: “xen”,
“id”: “i-0e6f8ec343d”,
“image_id”: “ami-abcd4321123”,
“instance_profile”: null,
“interfaces”: [
{
“id”: “eni-0a59a0b17e”,
“mac_address”: “0e:8f:6c:7d:62:d2”
}
],
“kernel”: null,
“key_name”: “test-customer-nodes”,
“launch_time”: “2019-02-11T15:31:50.000Z”,
“monitoring_state”: “disabled”,
“persistent”: false,
“placement”: {
“tenancy”: “default”,
“zone”: “us-west-1a”
},
“private_dns_name”: “ip-10-52-2-106.ec2.internal”,
“private_ip_address”: “10.52.2.106”,
“public_dns_name”: “”,
“public_ip_address”: null,
“ramdisk”: null,
“region”: “us-west-1”,
“requester_id”: null,
“root_device_type”: “ebs”,
“source_destination_check”: “true”,
“spot_instance_request_id”: null,
“state”: “running”,
“tags”: {
“Name”: “test643-test-CICD-REST”,
“aws:cloudformation:logical-id”: “RESTInstance”,
“aws:cloudformation:stack-id”: “arn:aws:cloudformation:us-west-1:xxxxxxxxxxx:stack/test643-test-CICD/05ea4900-2e12-11e9-8d3f-0e17762a99e0”,
“aws:cloudformation:stack-name”: “test643-test-CICD”,
“test:stack”: “test643-test-CICD”,
“test:type”: “rest”
},
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-12345678”
}
],
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-REST”,
“tag:test:type”: “rest”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“REST”,
“rest”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: “0”,
“architecture”: “x86_64”,
“block_device_mapping”: [
{
“attach_time”: “2019-02-11T15:31:48.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/sda1”,
“status”: “attached”,
“volume_id”: “vol-0b1fb89461e224b15”
},
{
“attach_time”: “2019-02-11T15:31:48.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdcb”,
“status”: “attached”,
“volume_id”: “vol-060b1f6dcf5d219d0”
},
{
“attach_time”: “2019-02-11T15:31:48.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdca”,
“status”: “attached”,
“volume_id”: “vol-00cb492d7c58f9c06”
}
],
“client_token”: “TDUPA-EMIns-A9RX5AZHEYDT”,
“ebs_optimized”: false,
“groups”: [
{
“id”: “sg-0f0bd6197e79e4f35”,
“name”: “test643-test-CICD-test-1L91BWTXSC9JT”
},
{
“id”: “sg-07f1b94efcc80297a”,
“name”: “test643-test-CICD-test-RGFU7R8EIH79”
}
],
“hypervisor”: “xen”,
“id”: “i-07b44c03face”,
“image_id”: “ami-abcd4321123”,
“instance_profile”: null,
“interfaces”: [
{
“id”: “eni-0210dc4620b”,
“mac_address”: “0e:bc:c6:f8:b9:78”
}
],
“kernel”: null,
“key_name”: “test-customer-nodes”,
“launch_time”: “2019-02-11T15:31:48.000Z”,
“monitoring_state”: “disabled”,
“persistent”: false,
“placement”: {
“tenancy”: “default”,
“zone”: “us-west-1a”
},
“private_dns_name”: “ip-10-52-3-163.ec2.internal”,
“private_ip_address”: “10.52.3.163”,
“public_dns_name”: “”,
“public_ip_address”: null,
“ramdisk”: null,
“region”: “us-west-1”,
“requester_id”: null,
“root_device_type”: “ebs”,
“source_destination_check”: “true”,
“spot_instance_request_id”: null,
“state”: “running”,
“tags”: {
“Name”: “test643-test-CICD-EM”,
“aws:cloudformation:logical-id”: “EMInstance”,
“aws:cloudformation:stack-id”: “arn:aws:cloudformation:us-west-1:xxxxxxxxxxx:stack/test643-test-CICD/05ea4900-2e12-11e9-8d3f-0e17762a99e0”,
“aws:cloudformation:stack-name”: “test643-test-CICD”,
“test:stack”: “test643-test-CICD”,
“test:type”: “em”
},
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-12345678”
}
],
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-EM”,
“tag:test:type”: “em”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“EM”,
“em”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: ,
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-test”,
“tag:test:type”: “test”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“test”,
“test”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: “0”,
“architecture”: “x86_64”,
“block_device_mapping”: [
{
“attach_time”: “2019-02-11T15:33:30.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/sda1”,
“status”: “attached”,
“volume_id”: “vol-0c8cc01c35cbc0213”
},
{
“attach_time”: “2019-02-11T15:33:30.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdcb”,
“status”: “attached”,
“volume_id”: “vol-0b73510f61e9155dc”
},
{
“attach_time”: “2019-02-11T15:33:30.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/xvdca”,
“status”: “attached”,
“volume_id”: “vol-0f9177e77fab4de7a”
}
],
“client_token”: “TDUPA-DMIns-26M4GXIL8C4D”,
“ebs_optimized”: false,
“groups”: [
{
“id”: “sg-029dcfea914704c6c”,
“name”: “test643-test-CICD-test-18OEH1BMW7NQ”
},
{
“id”: “sg-07f1b94efcc80297a”,
“name”: “test643-test-CICD-test-RGFU7R8EIH79”
}
],
“hypervisor”: “xen”,
“id”: “i-0c19f0f204”,
“image_id”: “ami-abcd4321123”,
“instance_profile”: {
“arn”: “arn:aws:iam::xxxxxxxxxxx:instance-profile/test643-test-CICD-test-1C35SJ8RLVCPC”,
“id”: “AIPAIS6PBTW5BS7O2PRHM”
},
“interfaces”: [
{
“id”: “eni-01ee90173a”,
“mac_address”: “0e:a5:14:e2:3a:64”
}
],
“kernel”: null,
“key_name”: “test-customer-nodes”,
“launch_time”: “2019-02-11T15:33:29.000Z”,
“monitoring_state”: “disabled”,
“persistent”: false,
“placement”: {
“tenancy”: “default”,
“zone”: “us-west-1a”
},
“private_dns_name”: “ip-10-52-2-101.ec2.internal”,
“private_ip_address”: “10.52.2.101”,
“public_dns_name”: “”,
“public_ip_address”: null,
“ramdisk”: null,
“region”: “us-west-1”,
“requester_id”: null,
“root_device_type”: “ebs”,
“source_destination_check”: “true”,
“spot_instance_request_id”: null,
“state”: “running”,
“tags”: {
“Name”: “test643-test-CICD-DM-Master-Agent1”,
“aws:cloudformation:logical-id”: “DMInstance”,
“aws:cloudformation:stack-id”: “arn:aws:cloudformation:us-west-1:xxxxxxxxxxx:stack/test643-test-CICD/05ea4900-2e12-11e9-8d3f-0e17762a99e0”,
“aws:cloudformation:stack-name”: “test643-test-CICD”,
“test:stack”: “test643-test-CICD”,
“test:type”: “test”
},
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-12345678”
}
],
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-DM-Master-Agent1”,
“tag:test:type”: “test”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“DM-Master-Agent1”,
“test”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: “1”,
“architecture”: “x86_64”,
“block_device_mapping”: [
{
“attach_time”: “2019-02-11T15:33:40.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/sda1”,
“status”: “attached”,
“volume_id”: “vol-05841c223326e837d”
}
],
“client_token”: “8f85a374-c4f6-73a3-cece-dcb30dabcf45_subnet-e36e71be_2”,
“ebs_optimized”: false,
“groups”: [
{
“id”: “sg-07f1b94efcc80297a”,
“name”: “test643-test-CICD-test-RGFU7R8EIH79”
},
{
“id”: “sg-091003c819ac47a0d”,
“name”: “test643-test-CICD-test-23KR3PF7E45F”
}
],
“hypervisor”: “xen”,
“id”: “i-0a019f3c21”,
“image_id”: “ami-abcd4321123”,
“instance_profile”: {
“arn”: “arn:aws:iam::xxxxxxxxxxx:instance-profile/test643-test-CICD-test-OTJUTYDK5NZ1”,
“id”: “AIPAJPE22HFHAZSK7MFTY”
},
“interfaces”: [
{
“id”: “eni-0bf21828”,
“mac_address”: “0e:89:26:7f:0a:d2”
}
],
“kernel”: null,
“key_name”: “test-customer-nodes”,
“launch_time”: “2019-02-11T15:33:40.000Z”,
“monitoring_state”: “enabled”,
“persistent”: false,
“placement”: {
“tenancy”: “default”,
“zone”: “us-west-1a”
},
“private_dns_name”: “ip-10-52-1-151.ec2.internal”,
“private_ip_address”: “10.52.1.151”,
“public_dns_name”: “”,
“public_ip_address”: null,
“ramdisk”: null,
“region”: “us-west-1”,
“requester_id”: null,
“root_device_type”: “ebs”,
“source_destination_check”: “true”,
“spot_instance_request_id”: null,
“state”: “running”,
“tags”: {
“Name”: “test643-test-CICD-test-01”,
“aws:autoscaling:groupName”: “test643-test-CICD-testAutoscalingGroup-5DJ3Z8BC44T0”,
“aws:cloudformation:logical-id”: “testAutoscalingGroup”,
“aws:cloudformation:stack-id”: “arn:aws:cloudformation:us-west-1:xxxxxxxxxxx:stack/test643-test-CICD/05ea4900-2e12-11e9-8d3f-0e17762a99e0”,
“aws:cloudformation:stack-name”: “test643-test-CICD”,
“test:stack”: “test643-test-CICD”,
“test:type”: “test”
},
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-12345678”
}
],
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-test-01”,
“tag:test:type”: “test”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“test-01”,
“test”
]
},
{
“_ansible_ignore_errors”: true,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“instances”: [
{
“ami_launch_index”: “0”,
“architecture”: “x86_64”,
“block_device_mapping”: [
{
“attach_time”: “2019-02-11T15:33:40.000Z”,
“delete_on_termination”: true,
“device_name”: “/dev/sda1”,
“status”: “attached”,
“volume_id”: “vol-0592b1f84b5d2d219”
}
],
“client_token”: “8f85a374-c4f6-73a3-cece-dcb30dabcf45_subnet-e36e71be_2”,
“ebs_optimized”: false,
“groups”: [
{
“id”: “sg-07f1b94efcc80297a”,
“name”: “test643-test-CICD-test-RGFU7R8EIH79”
},
{
“id”: “sg-091003c819ac47a0d”,
“name”: “test643-test-CICD-test-23KR3PF7E45F”
}
],
“hypervisor”: “xen”,
“id”: “i-05235ec69”,
“image_id”: “ami-abcd4321123”,
“instance_profile”: {
“arn”: “arn:aws:iam::xxxxxxxxxxx:instance-profile/test643-test-CICD-test-OTJUTYDK5NZ1”,
“id”: “AIPAJPE22HFHAZSK7MFTY”
},
“interfaces”: [
{
“id”: “eni-01662102dd”,
“mac_address”: “0e:a3:cf:24:e9:6e”
}
],
“kernel”: null,
“key_name”: “test-customer-nodes”,
“launch_time”: “2019-02-11T15:33:40.000Z”,
“monitoring_state”: “enabled”,
“persistent”: false,
“placement”: {
“tenancy”: “default”,
“zone”: “us-west-1a”
},
“private_dns_name”: “ip-10-52-2-188.ec2.internal”,
“private_ip_address”: “10.52.2.188”,
“public_dns_name”: “”,
“public_ip_address”: null,
“ramdisk”: null,
“region”: “us-west-1”,
“requester_id”: null,
“root_device_type”: “ebs”,
“source_destination_check”: “true”,
“spot_instance_request_id”: null,
“state”: “running”,
“tags”: {
“Name”: “test643-test-CICD-test-02”,
“aws:autoscaling:groupName”: “test643-test-CICD-testAutoscalingGroup-5DJ3Z8BC44T0”,
“aws:cloudformation:logical-id”: “testAutoscalingGroup”,
“aws:cloudformation:stack-id”: “arn:aws:cloudformation:us-west-1:xxxxxxxxxxx:stack/test643-test-CICD/05ea4900-2e12-11e9-8d3f-0e17762a99e0”,
“aws:cloudformation:stack-name”: “test643-test-CICD”,
“test:stack”: “test643-test-CICD”,
“test:type”: “test”
},
“virtualization_type”: “hvm”,
“vpc_id”: “vpc-12345678”
}
],
“invocation”: {
“module_args”: {
“aws_access_key”: “XYZXYXXYZXYZXYZ”,
“aws_secret_key”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“ec2_url”: null,
“filters”: {
“instance-state-name”: “running”,
“tag:Name”: “test643*-test-02”,
“tag:test:type”: “test”
},
“profile”: null,
“region”: “us-west-1”,
“security_token”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“validate_certs”: true
}
},
“item”: [
“test-02”,
“test”
]
}
]
}
}

`

Hi,

I think that you must use gather_fact in your playbook.

If this answer not answers your question, you can use option in ansible. for example : ansible --help for get ip of someone computer.

Or : ansible my_name_computer -m … --help

Regards