# Using a template for ansible\_host with inventory\_hostname breaks with delegation

**URL:** <https://forum.ansible.com/t/using-a-template-for-ansible-host-with-inventory-hostname-breaks-with-delegation/20449>\
**Category:** Ansible Project\
**Created:** [February 4, 2016, 1:52pm UTC](https://forum.ansible.com/t/using-a-template-for-ansible-host-with-inventory-hostname-breaks-with-delegation/20449 "2016-02-04T13:52:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maximilian\_Gass](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Maximilian\_Gass](https://forum.ansible.com/u/Maximilian_Gass)\
**Post date:** [February 4, 2016, 1:52pm UTC](https://forum.ansible.com/t/using-a-template-for-ansible-host-with-inventory-hostname-breaks-with-delegation/20449/1 "2016-02-04T13:52:35Z")

</div>

Hello,

I have a domain that I want to be appended to all hosts in the inventory. To reduce duplication, I thought I’d set ansible\_host={{inventory\_hostname}}.osf.credativ.lan.

Unfortunately, this breaks with delegation. Ansible connects to the play host, not to the host I delegated to, because of the template evaluation. I uploaded the inventory, playbook and output to a Gist: [https://gist.github.com/mxey/cb5a9e6483f42ca60cbb](https://gist.github.com/mxey/cb5a9e6483f42ca60cbb)

I found this issue on GitHub: [https://github.com/ansible/ansible/issues/10781](https://github.com/ansible/ansible/issues/10781). It seems like a related problem at least, but to me it’s not clear from the issue status whether it had been fixed or not.

Kind regards  
Maximilian Gaß
