# Concatenate text and variable for a key inside a dict

**URL:** <https://forum.ansible.com/t/concatenate-text-and-variable-for-a-key-inside-a-dict/23119>\
**Category:** Ansible Project\
**Created:** [November 28, 2016, 2:00pm UTC](https://forum.ansible.com/t/concatenate-text-and-variable-for-a-key-inside-a-dict/23119 "2016-11-28T14:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillaume\_Abrioux](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@Guillaume\_Abrioux](https://forum.ansible.com/u/Guillaume_Abrioux)\
**Post date:** [November 28, 2016, 2:00pm UTC](https://forum.ansible.com/t/concatenate-text-and-variable-for-a-key-inside-a-dict/23119/1 "2016-11-28T14:00:00Z")

</div>

Hi,

I would like to define a dict in group\_vars/all.yml where a key inside this dict would consist of a fixed string concatened to the result of : “{{ hostvars[inventory\_hostname][‘ansible\_hostname’] }}”.

This should looks like following:

✘ root@lab:~/playbook# cat group\_vars/all.yml

---

<div class="post-metadata">

**Author:** ![shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@shan](https://forum.ansible.com/u/shan)\
**Post date:** [December 15, 2016, 1:03pm UTC](https://forum.ansible.com/t/concatenate-text-and-variable-for-a-key-inside-a-dict/23119/2 "2016-12-15T13:03:02Z")

</div>

No one for this?  
I’m also getting this problem, it’d be nice if we could get some clarification.

Thanks!
