# Specifying a default value to a dictionary element when the dictionary variable does not exist

**URL:** <https://forum.ansible.com/t/specifying-a-default-value-to-a-dictionary-element-when-the-dictionary-variable-does-not-exist/25838>\
**Category:** Ansible Project\
**Created:** [October 27, 2017, 9:45am UTC](https://forum.ansible.com/t/specifying-a-default-value-to-a-dictionary-element-when-the-dictionary-variable-does-not-exist/25838 "2017-10-27T09:45:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishan\_jain](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@ishan\_jain](https://forum.ansible.com/u/ishan_jain)\
**Post date:** [October 27, 2017, 9:45am UTC](https://forum.ansible.com/t/specifying-a-default-value-to-a-dictionary-element-when-the-dictionary-variable-does-not-exist/25838/1 "2017-10-27T09:45:01Z")

</div>

Hi,

I am using a variables file for assigning values to the variables which i would then be using in my playbooks. Sometimes the values to these variables are further variables whose values are resolved at runtime, and sometimes they have default values as well.

vars.yaml

`
