# How to put period between two variables

**URL:** <https://forum.ansible.com/t/how-to-put-period-between-two-variables/23656>\
**Category:** Ansible Project\
**Created:** [February 7, 2017, 3:13am UTC](https://forum.ansible.com/t/how-to-put-period-between-two-variables/23656 "2017-02-07T03:13:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenton\_Brede](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@Kenton\_Brede](https://forum.ansible.com/u/Kenton_Brede)\
**Post date:** [February 7, 2017, 3:13am UTC](https://forum.ansible.com/t/how-to-put-period-between-two-variables/23656/1 "2017-02-07T03:13:02Z")

</div>

So this will print what I want:

- debug:  
msg: “{{ groups.tag\_Name\_shibboleth\_aws\_dev1[0] }}”

But I’m using a with\_items and need something like this:

- { host: ‘tag\_Name\_shibboleth\_aws\_dev1’, othervar: ‘blah’ }

- debug:  
msg: “{{ groups.item.host[0] }}”

Joining the two like so doesn’t work:

“{{ groups + ‘.’ + item.host }}”

How do I do this?

Thanks,

Kenton Brede

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [February 7, 2017, 10:15am UTC](https://forum.ansible.com/t/how-to-put-period-between-two-variables/23656/2 "2017-02-07T10:15:22Z")

</div>

Use the actual join filter:

"{{ [groups, '.', item.host | join] }}"

[https://docs.ansible.com/ansible/playbooks\_filters.html](https://docs.ansible.com/ansible/playbooks_filters.html)

Johannes

---

<div class="post-metadata">

**Author:** ![Stankovic\_Marko](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Stankovic\_Marko](https://forum.ansible.com/u/Stankovic_Marko)\
**Post date:** [February 7, 2017, 2:21pm UTC](https://forum.ansible.com/t/how-to-put-period-between-two-variables/23656/3 "2017-02-07T14:21:49Z")

</div>

You are looking for the "bracket notation", as described here:  
[http://docs.ansible.com/ansible/playbooks\_variables.html#what-makes-a-valid-variable-name](http://docs.ansible.com/ansible/playbooks_variables.html#what-makes-a-valid-variable-name)

So, this should work in your example:  
"{{ groups[item.host][0] }}"

Cheers,  
Marko  
CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain proprietary, confidential or trade secret information. This message is intended solely for the use of the addressee. If you are not the intended recipient and have received this message in error, please delete this message from your system. Any unauthorized reading, distribution, copying, or other use of this message or its attachments is strictly prohibited.
