Hi,

I’m trying to get the private ip of an instance by filtering by the tag
name but I get the following error:

fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an
undefined variable. The error was: 'dict object' has no attribute
'private_ip_address'\n\nThe
error appears to be in '/etc/ansible/loyalty/tasks/create_ec2.yaml': line
59, column 7, but may\nbe elsewhere in the file depe nding on the exact
syntax problem.\n\nThe offending line appears to be:\n\n      register:
ec2_metadata\n    - name: Muestro la IP publica de la ins tancia creada\n
     ^ here\n"}

Here my yaml:
- name: instances info
ec2_instance_info:
region: us-west-2
filters:
"tag:Name": myserver
register: ec2_metadata
- name: show info
debug:
msg: "{{ ec2_metadata.instances[0].private_ip_address }}"

What am I doing wrong?

Regards,

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGUDtnn%2B7HqrBTvgun8YWEi5%3DYC1OFwL5%3D5offf%2B59twNTy%3DHQ%40mail.gmail.com.

Reply via email to