# set\_fact moudle error ansible

**URL:** <https://forum.ansible.com/t/set-fact-moudle-error-ansible/32568>\
**Category:** Ansible Project\
**Created:** [March 31, 2020, 3:55am UTC](https://forum.ansible.com/t/set-fact-moudle-error-ansible/32568 "2020-03-31T03:55:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandy.hung](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@sandy.hung](https://forum.ansible.com/u/sandy.hung)\
**Post date:** [March 31, 2020, 3:55am UTC](https://forum.ansible.com/t/set-fact-moudle-error-ansible/32568/1 "2020-03-31T03:55:10Z")

</div>

Hi

error msg

fatal: [localhost]: FAILED! =\> {  
“msg”: “The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute ‘ansible\_facts’\n\nThe error appears to be in ‘/home/ldap/createefs.yml’: line 37, column 8, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - set\_fact:\n ^ here\n”  
}

- hosts: localhost  
connection: local  
gather\_facts: no

vars\_files:

- ec2key.yml  
vars:  
efs\_vol\_name: “test\_efs”

tasks:

- name: Create EFS fileserver  
efs:  
state: present  
region: “ap-southeast-1”  
name: “test\_efs”  
tags:  
Name: “test\_efstag”  
targets:
- subnet\_id: “subnet-46817120”  
security\_groups: [“sg-073c16c36bea62794”]  
performance\_mode: general\_purpose  
encrypt: yes

# - name: efs mount to ec2

# vars:

# efs\_vol\_name: “test\_efs”

- local\_action:  
module: efs\_info  
name: “{{ efs\_vol\_name }}”  
run\_once: true  
register: \_efs\_fact

- set\_fact:  
\_efs\_fact\_id: “{{ efs\_fact.ansible\_facts.efs[0].file\_system\_id }}”

- name: install efs libs  
apt:  
name: “{{ item }}”  
state: present  
become: yes  
with\_items:

- nfs-common

- name: Create data store directory for efs mount  
file:  
dest: “/home/ec2-user/{{ efs\_vol\_name }}”  
state: directory

- name: mount efs volume  
mount:  
path: “/home/ec2-user/{{ efs\_vol\_name }}”  
src: “{{ \_efs\_fact\_id }}.efs.ap-southeast-1.amazonaws.com:/”  
fstype: “nfs4”  
opts: “nfssevers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport”  
state: mounted  
become: yes

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [March 31, 2020, 6:33am UTC](https://forum.ansible.com/t/set-fact-moudle-error-ansible/32568/2 "2020-03-31T06:33:57Z")

</div>

There are 2 problems.

1) "efs\_info" says: "Note that the efs\_info module no longer returns  
ansible\_facts!"  
[https://docs.ansible.com/ansible/latest/modules/efs\_info\_module.html#synopsis](https://docs.ansible.com/ansible/latest/modules/efs_info_module.html#synopsis)

2) The underscore "\_" is missing in front of the variable "\_efs\_fact". Correct

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- set\_fact:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_efs\_fact\_id: "{{ \_efs\_fact. ... }}"

&nbsp;&nbsp;&nbsp;But, first you might want to take a look at the content of the registered  
&nbsp;&nbsp;&nbsp;variable and see what is available

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- debug:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var: \_efs\_fact

HTH,

&nbsp;&nbsp;-vlado

---

<div class="post-metadata">

**Author:** ![sandy.hung](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@sandy.hung](https://forum.ansible.com/u/sandy.hung)\
**Post date:** [March 31, 2020, 8:16am UTC](https://forum.ansible.com/t/set-fact-moudle-error-ansible/32568/3 "2020-03-31T08:16:18Z")

</div>

thank your help  
I have problem mount efs volume show msg “msg”: “Error mounting /home/ec2-user/test\_efs: mount.nfs4: Connection timed out\n”  
I have add to hosts
