# set\_fact strange behavior

**URL:** <https://forum.ansible.com/t/set-fact-strange-behavior/18800>\
**Category:** Ansible Project\
**Created:** [July 17, 2015, 4:57pm UTC](https://forum.ansible.com/t/set-fact-strange-behavior/18800 "2015-07-17T16:57:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Popov1](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Alexander\_Popov1](https://forum.ansible.com/u/Alexander_Popov1)\
**Post date:** [July 17, 2015, 4:57pm UTC](https://forum.ansible.com/t/set-fact-strange-behavior/18800/1 "2015-07-17T16:57:38Z")

</div>

- name: crate vpc.  
ec2\_vpc:  
…  
register: vpc

- debug: var=vpc.vpc\_id

- name: select public vpc  
set\_fact:  
vpc\_id: “{{vpc.vpc\_id}}”

- debug: var=vpc\_id

TASK [setup : setup : crate vpc] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [127.0.0.1] =\> {“changed”: false, … “vpc\_id”: “vpc-e31c0086”}

TASK [setup : setup : debug var=vpc.vpc\_id] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [127.0.0.1] =\> {  
“changed”: false,  
“vpc.vpc\_id”: “vpc-e31c0086”  
}

TASK [setup : setup : select public vpc] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [127.0.0.1] =\> {“ansible\_facts”: {“vpc\_id”: “vpc-e31c0086”}, “changed”: false}

TASK [setup : setup : debug var=vpc\_id] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [127.0.0.1] =\> {  
“changed”: false,  
“vpc\_id”: “VARIABLE IS NOT DEFINED!”  
}

what i’m doing wrong?
