# vars\_files and non-existing files

**URL:** <https://forum.ansible.com/t/vars-files-and-non-existing-files/25193>\
**Category:** Ansible Project\
**Created:** [August 7, 2017, 12:36pm UTC](https://forum.ansible.com/t/vars-files-and-non-existing-files/25193 "2017-08-07T12:36:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![w.pietruszewski](https://avatars.discourse-cdn.com/v4/letter/w/ecc23a/32.png) [@w.pietruszewski](https://forum.ansible.com/u/w.pietruszewski)\
**Post date:** [August 7, 2017, 12:36pm UTC](https://forum.ansible.com/t/vars-files-and-non-existing-files/25193/1 "2017-08-07T12:36:22Z")

</div>

Hi,

I’d like to propose a change/feature to vars\_files and how it loads the files. Right now when the vars file does not exists an error is risen:

raise AnsibleFileNotFound(“vars file %s was not found” % vars\_file\_item)

it would be useful if it could skip missing file and proceed without throwing an error. This would help in situation in which the user uses hierarchical and not defined file structure. For example:

vars\_files:

- “/etc/ansible/vars/default\_site.yml”
- “vars/{{site\_name}}.yml”

where site\_name is passed as a parameter to ansible\_playbook. I know there is include\_vars functionality however this is a task so it can’t be used to load certain variables like ansible\_user or ansible\_password. It also is very verbose which is also not very elegant.

Let me know what is your thought on this.

Best regards,  
Wojtek
