# Enhancing model data

**URL:** <https://forum.ansible.com/t/enhancing-model-data/19452>\
**Category:** Ansible Project\
**Created:** [October 7, 2015, 8:10am UTC](https://forum.ansible.com/t/enhancing-model-data/19452 "2015-10-07T08:10:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mirko\_Friedenhagen](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mirko\_Friedenhagen](https://forum.ansible.com/u/Mirko_Friedenhagen)\
**Post date:** [October 7, 2015, 8:10am UTC](https://forum.ansible.com/t/enhancing-model-data/19452/1 "2015-10-07T08:10:50Z")

</div>

Hello,

I have a model/dictionary as YAML and want to define default values before using the model in several templates.

t\_default: bar  
p\_default: 42  
cfg:  
h1:  
t: foo  
h2:  
p: 1

Now I want to prepare cfg so that cfg.h1.p == 42 and cfg.h2.t == bar

I now have to use a lot of | default filtering but like to do this only once. As this is related to a role, I would like to put the code in a directory of the role. As far as I understood, library may only hold action modules.

Regards  
Mirko
