On 21.03.19 22:48, tinkuchowdar...@gmail.com wrote:> here is the dubug output ec2-facts > > "ec2": { > "changed": false, > "failed": false, > "instances": [ > { > "ami_launch_index": 0, > "architecture": "x86_64", [..] > "product_codes": [], > "public_dns_name": > "xxxxxxx.us-east-2.compute.amazonaws.com", > "public_ip_address": "xx.xxx.44.51", > "root_device_name": "/dev/xvda", [...] > } > ] > } > } > > > i want to use debug option in playbook to print only the public ip > > ec2.instances.public_ip is not working instances is an array of dicts here.
You'll need a 0 in there to access the first element of that list: ec2.instances.0.public_ip_address - Sebastian -- Sebastian Meyer Linux Consultant & Trainer Mail: me...@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/57e822cd-63ff-777b-4f0c-11b3f8169eeb%40b1-systems.de. For more options, visit https://groups.google.com/d/optout.