# Error mounting EFS volume to EC2 instance using ansible facts

**URL:** <https://forum.ansible.com/t/error-mounting-efs-volume-to-ec2-instance-using-ansible-facts/25504>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [September 18, 2017, 12:35am UTC](https://forum.ansible.com/t/error-mounting-efs-volume-to-ec2-instance-using-ansible-facts/25504 "2017-09-18T00:35:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anuj\_Dogra](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Anuj\_Dogra](https://forum.ansible.com/u/Anuj_Dogra)\
**Post date:** [September 18, 2017, 12:35am UTC](https://forum.ansible.com/t/error-mounting-efs-volume-to-ec2-instance-using-ansible-facts/25504/1 "2017-09-18T00:35:33Z")

</div>

I have the following tasks in my ansible playbook to register the AZ for an AWS resource:

- name: Get current AZ from AWS.  
uri:  
url: [http://169.254.169.254/latest/meta-data/placement/availability-zone](http://169.254.169.254/latest/meta-data/placement/availability-zone)  
return\_content: yes  
register: aws\_current\_az

- name: Ensure EFS volume is mounted.  
mount:  
name: “{{ efs\_mount\_dir }}”  
src: “{{ aws\_current\_az.content }}.{{ efs\_file\_system\_id }}.efs.{{ aws\_region }}.amazonaws.com:/”  
fstype: nfs4  
opts: nfsvers=4.1  
state: mounted

However, I am encountering the following error when I check the diff on the ansible playbook:  
**FAILED! =\> {“failed”: true, “msg”: "the field ‘args’ has an invalid value, which appears to include a variable that is undefined. The error was: ‘dict object’ has no attribute 'content**

The ‘content’ being registered in the first task, does not register in the second.

This is causing my idempotency checks to fail. These tasks work fine when running, but only fail when checking the difference. Any idea why?

FYI: Using the following geerlingguy Ansible playbook: [https://www.jeffgeerling.com/blog/2017/mount-aws-efs-filesystem-on-ec2-instance-ansible](https://www.jeffgeerling.com/blog/2017/mount-aws-efs-filesystem-on-ec2-instance-ansible)

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Goetz\_Leupold](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@Goetz\_Leupold](https://forum.ansible.com/u/Goetz_Leupold)\
**Post date:** [September 18, 2017, 10:38am UTC](https://forum.ansible.com/t/error-mounting-efs-volume-to-ec2-instance-using-ansible-facts/25504/2 "2017-09-18T10:38:06Z")

</div>

Did you debug the var: aws\_current\_az?  
A possible problem could be, that is a list or not set correctly.

---

<div class="post-metadata">

**Author:** ![Anuj\_Dogra](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Anuj\_Dogra](https://forum.ansible.com/u/Anuj_Dogra)\
**Post date:** [September 18, 2017, 12:17pm UTC](https://forum.ansible.com/t/error-mounting-efs-volume-to-ec2-instance-using-ansible-facts/25504/3 "2017-09-18T12:17:33Z")

</div>

Yeah, I tried that as well but still encountering the same error. I have a Jenkins job that checks idempotency with the Ansible playbook that is still failing even with the following:

- name: Ensure EFS volume is mounted.  
mount:  
name: “{{ efs\_mount\_dir }}”  
src: “{{ aws\_current\_az.content }}.{{ efs\_file\_system\_id }}.efs.{{ aws\_region }}.amazonaws.com:/”  
fstype: nfs4  
opts: nfsvers=4.1  
state: mounted  
changed\_when: False  
ignore\_errors: True
- debug: var=aws\_current\_az

---

<div class="post-metadata">

**Author:** ![viper233](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/viper233/32/2060_2.png) [@viper233](https://forum.ansible.com/u/viper233)\
**Post date:** [September 18, 2017, 8:54pm UTC](https://forum.ansible.com/t/error-mounting-efs-volume-to-ec2-instance-using-ansible-facts/25504/4 "2017-09-18T20:54:56Z")

</div>

There is a PR for an az facts module open at the moment which is able to return the available AZ’s  
[https://github.com/ansible/ansible/pull/20690](https://github.com/ansible/ansible/pull/20690)
