# delegate\_to not working with hosts not in inventory?

**URL:** <https://forum.ansible.com/t/delegate-to-not-working-with-hosts-not-in-inventory/16970>\
**Category:** Ansible Project\
**Created:** [December 5, 2014, 1:14pm UTC](https://forum.ansible.com/t/delegate-to-not-working-with-hosts-not-in-inventory/16970 "2014-12-05T13:14:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Rice](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@Tim\_Rice](https://forum.ansible.com/u/Tim_Rice)\
**Post date:** [December 5, 2014, 1:14pm UTC](https://forum.ansible.com/t/delegate-to-not-working-with-hosts-not-in-inventory/16970/1 "2014-12-05T13:14:13Z")

</div>

Just upgraded to 1.8.2 and noticed a change in behavior (previosuly on 1.7.2)

delegate\_to only works when the host we wnat to delegate to is in the current inventory, is this intentional? It was working fine on 1.7.2

Also, another delegate\_to apparent change… we previously used 'delegate\_to: “{{ nagios\_server}}” ’ to delegate to different hosts (nagios servers) when required… this has also stopped working. it seems it doesnt evaluate the variable any more and attempts to use the string “{{ nagios\_server}}” as a host.

Thanks!

---

<div class="post-metadata">

**Author:** ![Tim\_Rice](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@Tim\_Rice](https://forum.ansible.com/u/Tim_Rice)\
**Post date:** [December 5, 2014, 1:27pm UTC](https://forum.ansible.com/t/delegate-to-not-working-with-hosts-not-in-inventory/16970/2 "2014-12-05T13:27:10Z")

</div>

Can add that we have downgraded to 1.8.1 and both things appear to work fine…

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [December 5, 2014, 2:43pm UTC](https://forum.ansible.com/t/delegate-to-not-working-with-hosts-not-in-inventory/16970/3 "2014-12-05T14:43:26Z")

</div>

Thanks Tim, there was a bugfix related to delegate\_to in this release, which may have created this bug. We’ll look into this today.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 5, 2014, 4:44pm UTC](https://forum.ansible.com/t/delegate-to-not-working-with-hosts-not-in-inventory/16970/4 "2014-12-05T16:44:37Z")

</div>

“delegate\_to only works when the host we wnat to delegate to is in the current inventory, is this intentional? It was working fine on 1.7.2”

Ok, doesn’t sound to be super breaking, but we’re on it. Thanks for the report.

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [December 8, 2014, 10:13pm UTC](https://forum.ansible.com/t/delegate-to-not-working-with-hosts-not-in-inventory/16970/5 "2014-12-08T22:13:34Z")

</div>

Just committed a fix for this to devel that should fix both of these  
problems. There was an initial fix last week which only fixed the  
first problem. In case you're looking to patch your code, the new  
fix[1]\_ overwrites the previous one[2]\_: so you'll need to apply it  
manually

[1]\_: [https://github.com/ansible/ansible/commit/3269a349f32a2b5c1fc079a2d174e01c541f444b](https://github.com/ansible/ansible/commit/3269a349f32a2b5c1fc079a2d174e01c541f444b)  
[2]\_: [https://github.com/ansible/ansible/commit/b042fcc349f965a60943a3bfcf25f143b5fff3dc](https://github.com/ansible/ansible/commit/b042fcc349f965a60943a3bfcf25f143b5fff3dc)

-Toshio
