# Using YAML anchors in host\_vars that are defined in group\_vars

**URL:** <https://forum.ansible.com/t/using-yaml-anchors-in-host-vars-that-are-defined-in-group-vars/26487>\
**Category:** Ansible Project\
**Created:** [January 16, 2018, 11:11am UTC](https://forum.ansible.com/t/using-yaml-anchors-in-host-vars-that-are-defined-in-group-vars/26487 "2018-01-16T11:11:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bretgiddings](https://avatars.discourse-cdn.com/v4/letter/b/77aa72/32.png) [@bretgiddings](https://forum.ansible.com/u/bretgiddings)\
**Post date:** [January 16, 2018, 11:11am UTC](https://forum.ansible.com/t/using-yaml-anchors-in-host-vars-that-are-defined-in-group-vars/26487/1 "2018-01-16T11:11:46Z")

</div>

Hello,

I’m trying to create some snippets of configuration data that is to be shared between two servers so that various different tunnel configs can be kept in one place. So, I was hoping to have something like the following defined in group\_vars/all

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 16, 2018, 4:06pm UTC](https://forum.ansible.com/t/using-yaml-anchors-in-host-vars-that-are-defined-in-group-vars/26487/2 "2018-01-16T16:06:10Z")

</div>

YAML anchors and aliases, must exist in the same file, they cannot span multiple files, as the ref/deref happens on per file parsing.
