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,
`