# Upload var\_files based on a value or ignore if not exist

**URL:** <https://forum.ansible.com/t/upload-var-files-based-on-a-value-or-ignore-if-not-exist/35515>\
**Category:** Ansible Project\
**Created:** [July 18, 2021, 12:46pm UTC](https://forum.ansible.com/t/upload-var-files-based-on-a-value-or-ignore-if-not-exist/35515 "2021-07-18T12:46:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dudu.c](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dudu.c](https://forum.ansible.com/u/dudu.c)\
**Post date:** [July 18, 2021, 12:46pm UTC](https://forum.ansible.com/t/upload-var-files-based-on-a-value-or-ignore-if-not-exist/35515/1 "2021-07-18T12:46:45Z")

</div>

- hosts: server1  
vars\_files:
- main.yml
- second.yml

Hi,

I have a a small playbook that is using variables based on a file.

Main.yml the file will always exist while second.yml might exist.

1. Is it possible to configure the playbook to continue in case second.yml file does not existt?

2. If I will add to the main. yam the following value

Additional\_file: yes

Can I configure the playbook to load second.yml only in case Additional\_file value = yes

Thanks

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 18, 2021, 7:36pm UTC](https://forum.ansible.com/t/upload-var-files-based-on-a-value-or-ignore-if-not-exist/35515/2 "2021-07-18T19:36:36Z")

</div>

Add a stat task first and only include the file if it’s there
