# Optional valut import

**URL:** <https://forum.ansible.com/t/optional-valut-import/16203>\
**Category:** Ansible Project\
**Created:** [September 12, 2014, 9:02pm UTC](https://forum.ansible.com/t/optional-valut-import/16203 "2014-09-12T21:02:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adham\_H](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Adham\_H](https://forum.ansible.com/u/Adham_H)\
**Post date:** [September 12, 2014, 9:02pm UTC](https://forum.ansible.com/t/optional-valut-import/16203/1 "2014-09-12T21:02:13Z")

</div>

Hey,

I was wondering if its possible to do optional import of vault encrypted files. i.e. if a password/password file is presented the encrypted file will be included. Else the file will be ignored.

Thanks

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 12, 2014, 9:12pm UTC](https://forum.ansible.com/t/optional-valut-import/16203/2 "2014-09-12T21:12:49Z")

</div>

Yeah, this is presently not possible unfortunately.

I think this could be potentially confusing unless it threw a warning when attempting to read the file - because you might not know why a variable would be undefined.

If we did this, it would need to be a config setting, default off, in ansible.cfg.

I’m not yet sure that we need to, but one thing that is not possible is to prompt at load time, because you might be halfway into the playbook run – this would make it hard to run ansible via expect type scripts and it would be unpredictable when a prompt might come up.

---

<div class="post-metadata">

**Author:** ![Shaunak\_Kashyap](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Shaunak\_Kashyap](https://forum.ansible.com/u/Shaunak_Kashyap)\
**Post date:** [September 12, 2014, 9:53pm UTC](https://forum.ansible.com/t/optional-valut-import/16203/3 "2014-09-12T21:53:38Z")

</div>

You could make it work like so: [https://gist.github.com/ycombinator/21dd0ca3c0ee9472f64d](https://gist.github.com/ycombinator/21dd0ca3c0ee9472f64d)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 12, 2014, 9:54pm UTC](https://forum.ansible.com/t/optional-valut-import/16203/4 "2014-09-12T21:54:51Z")

</div>

Well that would not import it if that first file were not present, yes, but most likely it would be present.

---

<div class="post-metadata">

**Author:** ![Shaunak\_Kashyap](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Shaunak\_Kashyap](https://forum.ansible.com/u/Shaunak_Kashyap)\
**Post date:** [September 12, 2014, 9:56pm UTC](https://forum.ansible.com/t/optional-valut-import/16203/5 "2014-09-12T21:56:51Z")

</div>

Ah yes, I misinterpreted “if a password/password file is presented” as the vaulted file being present/absent not the vault password/password file. Sorry.

---

<div class="post-metadata">

**Author:** ![Adham\_H](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Adham\_H](https://forum.ansible.com/u/Adham_H)\
**Post date:** [September 13, 2014, 6:51pm UTC](https://forum.ansible.com/t/optional-valut-import/16203/6 "2014-09-13T18:51:50Z")

</div>

Michael,

I think this makes sense the default behaviour should fail and you should override the ignore import by config or even a command line argument.
