2021年1月20日星期三

Ansible - How to access debug output from register?

**Hello. Please help me with below. I want to access '3.21.228.186' of "public_ip": "3.21.228.186". What should be debug-var variable ? ##########Full output:

How can I solve this ?    > ok: [localhost] => {  >   >     "start_AWS": {  >   >         "changed": true,  >   >         "failed": false,  >   >         "instance_ids": [  >   >             "i-12233ef3073q3622sad7baweq3445af406526"  >   >         ],  >   >         "instances": [  >   >             {  >   >                 "ami_launch_index": "0",  >   >                 "architecture": "x86_64",  >   >                 "block_device_mapping": {  >   >                     "/dev/sda1": {  >   >                         "delete_on_termination": true,  >   >                         "status": "attached",  >   >                         "volume_id": "vol-043ce7d3375a194d7"  >   >                     }  >   >                 },  >   >                 "dns_name": "ec2-3-21-228-186.us-east-2.compute.amazonaws.com",  >   >                 "ebs_optimized": false,  >   >                 "groups": {  >   >                     "sg-0d1460e84b87c3945": "launch-wizard-1"  >   >                 },  >   >                 "hypervisor": "xen",  >   >                 "id": "i-0736227baaf406526",  >   >                 "image_id": "ami-0a91cd140a1fc148a",  >   >                 "instance_type": "t2.micro",  >   >                 "kernel": null,  >   >                 "key_name": "hem",  >   >                 "launch_time": "2021-01-21T03:50:01.000Z",  >   >                 "placement": "us-east-2b",  >   >                 "private_dns_name": "ip-172-31-24-208.us-east-2.compute.internal",  >   >                 "private_ip": "172.31.24.208",  >   >                 "public_dns_name": "ec2-3-21-228-186.us-east-2.compute.amazonaws.com",  >   >                 "public_ip": "3.21.228.186",  >   >                 "ramdisk": null,  >   >                 "region": "us-east-2",  >   >                 "root_device_name": "/dev/sda1",  >   >                 "root_device_type": "ebs",  >   >                 "state": "running",  >   >                 "state_code": 16,  >   >                 "tags": {  >   >                     "Name": "ubuntu"  >   >                 },  >   >                 "tenancy": "default",  >   >                 "virtualization_type": "hvm"  >   >             }  >   >         ],  >   >         "tagged_instances": []  >   >     }  >   > }  

How can I solve this ? Thanks in advance


Please help.

I am trying to take this output and give it as input to another task

Thanks, Srivi

Please ignore below Dummy details for error "It looks like your post is mostly code, please add some more details"

https://stackoverflow.com/questions/65821045/ansible-how-to-access-debug-output-from-register January 21, 2021 at 12:06PM

没有评论:

发表评论