# Loading variables into plabook tasks failing

**URL:** <https://forum.ansible.com/t/loading-variables-into-plabook-tasks-failing/25927>\
**Category:** Ansible Project\
**Created:** [November 4, 2017, 7:40pm UTC](https://forum.ansible.com/t/loading-variables-into-plabook-tasks-failing/25927 "2017-11-04T19:40:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdul\_sattar\_Shaikh](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@abdul\_sattar\_Shaikh](https://forum.ansible.com/u/abdul_sattar_Shaikh)\
**Post date:** [November 4, 2017, 7:40pm UTC](https://forum.ansible.com/t/loading-variables-into-plabook-tasks-failing/25927/1 "2017-11-04T19:40:38Z")

</div>

Hi All,

I am having below playbooks, I intent to include variables and I have got below message as “OK” and “changed” but file not copied over.

please review and advise.

Main playbook:  
cat fetchfile.yml

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [November 4, 2017, 7:58pm UTC](https://forum.ansible.com/t/loading-variables-into-plabook-tasks-failing/25927/2 "2017-11-04T19:58:02Z")

</div>

> I am having below playbooks, I intent to include variables and I have got  
> below message as "OK" and "changed" but file not copied over.
> 
> please review and advise.
> 
> Main playbook:  
> cat fetchfile.yml  
> ---  
> &nbsp;&nbsp;&nbsp;- hosts: all  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tasks:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- name: Include vars of vars.yml into the 'dest' variable.  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;include\_vars:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file: vars.yml  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: dest  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- fetch:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;src: /tmp/xyz.txt  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dest: "{{ dest }}/"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flat: yes
> 
> ------------ variable playbook:  
> cat variable.yml  
> dest: /u01/app

\<snip /\>

> ------------------ it shows above as changed but when I am checking xyz.txt  
> file at "dest" location, I could not see it, please advise.

You are looking at the wrong destination.  
Look in the directory you run ansible-playbook, you will find a directory starting with {  
If you run ansible-playbook with -vvv you'll see what I mean.

The name on the include\_vars means, put the content in the file under the variable dest, so you dest is actually:  
dest:  
&nbsp;&nbsp;dest: /u01/app

It you add  
&nbsp;&nbsp;- debug: var=dest  
after include\_vars you will also see that.

---

<div class="post-metadata">

**Author:** ![abdul\_sattar\_Shaikh](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@abdul\_sattar\_Shaikh](https://forum.ansible.com/u/abdul_sattar_Shaikh)\
**Post date:** [November 5, 2017, 7:35am UTC](https://forum.ansible.com/t/loading-variables-into-plabook-tasks-failing/25927/3 "2017-11-05T07:35:03Z")

</div>

Hi Kai,

Thank you for quick response, will try advised and update you.

Thanks,  
Abdul

---

<div class="post-metadata">

**Author:** ![abdul\_sattar\_Shaikh](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@abdul\_sattar\_Shaikh](https://forum.ansible.com/u/abdul_sattar_Shaikh)\
**Post date:** [November 5, 2017, 8:02am UTC](https://forum.ansible.com/t/loading-variables-into-plabook-tasks-failing/25927/4 "2017-11-05T08:02:35Z")

</div>

Hi Kai,

Yes, I can see the directory starting with {u’dest’: u’ and in this directory i could see xyz.txt file, exact patch is as : {u’dest’: u’/u01/app/xyz.txt

Since I wish to put this file at /u01/app ( destination folder specified in variables.yml) and my main playbook which is fetchfile.yml is not doing it, please suggest where I am doing wrong in here.

Thank you.  
Abdul

---

<div class="post-metadata">

**Author:** ![abdul\_sattar\_Shaikh](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@abdul\_sattar\_Shaikh](https://forum.ansible.com/u/abdul_sattar_Shaikh)\
**Post date:** [November 5, 2017, 9:10am UTC](https://forum.ansible.com/t/loading-variables-into-plabook-tasks-failing/25927/5 "2017-11-05T09:10:50Z")

</div>

Hi Kai,

it is working for me now, I have removed name: dest .

Thank you so much for advise, have a nice day.

Thank you.  
Abdul
