# Include\_vars with predefined variables?

**URL:** <https://forum.ansible.com/t/include-vars-with-predefined-variables/24368>\
**Category:** Ansible Project\
**Created:** [May 1, 2017, 8:16pm UTC](https://forum.ansible.com/t/include-vars-with-predefined-variables/24368 "2017-05-01T20:16:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![burns498](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@burns498](https://forum.ansible.com/u/burns498)\
**Post date:** [May 1, 2017, 8:16pm UTC](https://forum.ansible.com/t/include-vars-with-predefined-variables/24368/1 "2017-05-01T20:16:16Z")

</div>

Hello - Can include\_vars also include predefined variables? I have a variable {{ WMS\_HOME }} which debug resoles properly but include\_vars doesn’t carry it through.

**role/vars/SDN500.yml**

> backup\_files:
> 
> - src\_path: “{{ WMS\_HOME }}/distribution/”  
> filename: “scope.war”  
> dest\_path: “{{ SDN\_backup\_dir }}/{{ code\_tier }}/{{ inventory\_hostname\_short }}/scope/”

**Code:**

`

- name: Include vars for SDN list  
tags: sdnlist  
include\_vars: “{{ item }}.yml”  
register: include\_vars\_output  
with\_items: “{{ SDNs }}”

- debug: msg=“Home={{ WMOS\_HOME }}”  
tags: sdnlist

- debug: msg=“Src Path={{ item.src\_path }}”  
tags: sdnlist  
with\_items: “{{ backup\_files }}”  
`

**Output:**

> TASK [role\_utility\_sdn\_backups : Include vars for SDN list] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> ok: [host] =\> (item=SDN500)  
> TASK [role\_utility\_sdn\_backups : debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> ok: [host] =\> {  
> “msg”: “Home=/apps/scope/manh/WM”  
> }  
> TASK [role\_utility\_sdn\_backups : debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> ok: [host] =\> (item={u’filename’: u’scope.war’, u’src\_path’: u’{# WMS\_HOME #}/distribution/‘, u’dest\_path’: u’{# SDN\_backup\_dir #}/{# code\_tier #}/{# inventory\_hostname\_short #}/scope/'}) =\> {  
> “item”: {  
> “dest\_path”: “{# SDN\_backup\_dir #}/{# code\_tier #}/{# inventory\_hostname\_short #}/scope/”,  
> “filename”: “scope.war”,  
> “src\_path”: “{# WMS\_HOME #}/distribution/”  
> },  
> “msg”: “Src Path=/distribution/”  
> }

Thanks
