# delegate\_to and ansible\_host

**URL:** <https://forum.ansible.com/t/delegate-to-and-ansible-host/25194>\
**Category:** Ansible Project\
**Created:** [August 7, 2017, 2:00pm UTC](https://forum.ansible.com/t/delegate-to-and-ansible-host/25194 "2017-08-07T14:00:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladimir-csp](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vladimir-csp](https://forum.ansible.com/u/Vladimir-csp)\
**Post date:** [August 7, 2017, 2:00pm UTC](https://forum.ansible.com/t/delegate-to-and-ansible-host/25194/1 "2017-08-07T14:00:55Z")

</div>

Hi all.  
I have a problem with delegate\_to.  
I use a role which governs users, and it has a delegated task that gathers getent facts from a specific server, let’s say ‘getent-server’

Everything works fine until I try to apply this role to an unresolvable host, let’s say ‘ur-host’ by using ‘–limit ur-host -e ansible\_host=$ip\_addr’. In this case delegation does not work, or rather task gets delegated to ‘ur-host’ itself instead of ‘getent-server’. How can I make delegation work in these conditions?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 8, 2017, 1:05pm UTC](https://forum.ansible.com/t/delegate-to-and-ansible-host/25194/2 "2017-08-08T13:05:47Z")

</div>

All host need to exist in the inventory for Ansible to work, thats just how Ansible works.

---

<div class="post-metadata">

**Author:** ![Vladimir-csp](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vladimir-csp](https://forum.ansible.com/u/Vladimir-csp)\
**Post date:** [August 11, 2017, 12:37pm UTC](https://forum.ansible.com/t/delegate-to-and-ansible-host/25194/3 "2017-08-11T12:37:36Z")

</div>

All hosts are already in the inventory. The delegation breaks when ansible\_host variable is given on the command line.
