# partial dictionary merge available?

**URL:** <https://forum.ansible.com/t/partial-dictionary-merge-available/33065>\
**Category:** Ansible Project\
**Created:** [June 1, 2020, 3:58pm UTC](https://forum.ansible.com/t/partial-dictionary-merge-available/33065 "2020-06-01T15:58:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toni\_Mueller](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@Toni\_Mueller](https://forum.ansible.com/u/Toni_Mueller)\
**Post date:** [June 1, 2020, 3:58pm UTC](https://forum.ansible.com/t/partial-dictionary-merge-available/33065/1 "2020-06-01T15:58:34Z")

</div>

Hi,

I've just read that there is a way to merge dictionaries, to accumulate  
values across the variable hierarchy, but it is supposed to be a very  
bad idea. Would it be difficult to allow this merge feature on just a  
select number of variables? Or is there a better way to deal with a  
large inventory (3-4 digit numbers of items), which is unwieldy to begin  
with?

Cheers,  
Toni

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [June 1, 2020, 4:05pm UTC](https://forum.ansible.com/t/partial-dictionary-merge-available/33065/2 "2020-06-01T16:05:03Z")

</div>

> Hi,
> 
> I've just read that there is a way to merge dictionaries, to accumulate  
> values across the variable hierarchy, but it is supposed to be a very  
> bad idea. Would it be difficult to allow this merge feature on just a  
> select number of variables? Or is there a better way to deal with a  
> large inventory (3-4 digit numbers of items), which is unwieldy to begin  
> with?

Where does that inventory come from? Maybe you could use a dynamic inventory?

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Toni\_Mueller](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@Toni\_Mueller](https://forum.ansible.com/u/Toni_Mueller)\
**Post date:** [June 1, 2020, 5:07pm UTC](https://forum.ansible.com/t/partial-dictionary-merge-available/33065/3 "2020-06-01T17:07:27Z")

</div>

Hi Racke,

> Where does that inventory come from? Maybe you could use a dynamic inventory?

so far, it's a static inventory. It will be a dynamic inventory once  
this stuff is a bit more fleshed out - but the "cost" to have a dynamic  
inventory, is significant: The relevant database servers are far away,  
"messy", and quite slow. Therefore, I wanted to start with a static  
inventory.

Cheers,  
Toni
