# Concatenate text and variable for a key in a dict

**URL:** <https://forum.ansible.com/t/concatenate-text-and-variable-for-a-key-in-a-dict/23098>\
**Category:** Ansible Project\
**Created:** [November 25, 2016, 1:46pm UTC](https://forum.ansible.com/t/concatenate-text-and-variable-for-a-key-in-a-dict/23098 "2016-11-25T13:46:05Z")\
**Posts on this page:** 1\
**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 25, 2016, 1:46pm UTC](https://forum.ansible.com/t/concatenate-text-and-variable-for-a-key-in-a-dict/23098/1 "2016-11-25T13:46:05Z")

</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
