# Question about variables.

**URL:** <https://forum.ansible.com/t/question-about-variables/32223>\
**Category:** Ansible Project\
**Created:** [February 13, 2020, 4:21pm UTC](https://forum.ansible.com/t/question-about-variables/32223 "2020-02-13T16:21:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jamal\_Gardiner](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@Jamal\_Gardiner](https://forum.ansible.com/u/Jamal_Gardiner)\
**Post date:** [February 13, 2020, 4:21pm UTC](https://forum.ansible.com/t/question-about-variables/32223/1 "2020-02-13T16:21:28Z")

</div>

- name: Gather EC2 Snapshot Info  
ec2\_snapshot\_info:  
filters:  
“tag:Name”: fortune  
register: snap

- name: AMI registration from EBS Snapshot  
ec2\_ami:  
name: fortune  
state: present  
architecture: x86\_64  
virtualization\_type: hvm  
root\_device\_name: /dev/xvda  
device\_mapping:

- device\_name: /dev/xvda  
volume\_size: 8  
snapshot\_id: “{{ snap.snapshot\_id }}”  
volume\_type: gp2  
delete\_on\_termination: true  
register: ami

I’m receiving this error.

The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute 'snapshot\_id

I believe is has something to do with my variable. Anyone have an idea?

---

<div class="post-metadata">

**Author:** ![Stephen\_Nesbitt](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@Stephen\_Nesbitt](https://forum.ansible.com/u/Stephen_Nesbitt)\
**Post date:** [February 13, 2020, 4:58pm UTC](https://forum.ansible.com/t/question-about-variables/32223/2 "2020-02-13T16:58:44Z")

</div>

I’m not familiar with the ec2\_snapshot info module, but the core problem is the registered variable “snap” - which is a dictionary - does not have a key ‘snapshot\_id’.

What I often do in these cases is to add a debug task immediately after the task that registers the variable which simply dumps the value of “snap”. Something like this (not tested):  
`

- name: Debug Snap Task  
debug:  
msg: “ec2\_ami results {{ snap }}”  
`

This should show you whether snapshot\_id exists and how to access it.

-steve
