# How to delegate set\_fact?

**URL:** <https://forum.ansible.com/t/how-to-delegate-set-fact/25595>\
**Category:** Ansible Project\
**Created:** [September 26, 2017, 10:18am UTC](https://forum.ansible.com/t/how-to-delegate-set-fact/25595 "2017-09-26T10:18:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cev\_Ing](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@Cev\_Ing](https://forum.ansible.com/u/Cev_Ing)\
**Post date:** [September 26, 2017, 10:18am UTC](https://forum.ansible.com/t/how-to-delegate-set-fact/25595/1 "2017-09-26T10:18:00Z")

</div>

I have the following inventory:

test1 ansible\_host=127.0.22.1  
test2 ansible\_host=127.0.22.2

and the following playbook:

---

<div class="post-metadata">

**Author:** ![Cev\_Ing](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@Cev\_Ing](https://forum.ansible.com/u/Cev_Ing)\
**Post date:** [October 6, 2017, 11:25am UTC](https://forum.ansible.com/t/how-to-delegate-set-fact/25595/2 "2017-10-06T11:25:43Z")

</div>

Is it a bug, that set\_fact ignores delegate\_facts?

---

<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:** [October 6, 2017, 7:55pm UTC](https://forum.ansible.com/t/how-to-delegate-set-fact/25595/3 "2017-10-06T19:55:57Z")

</div>

I can speculate since the documentation is a little iffy.

In the documentation is says  
"delegate\_facts  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Boolean that allows you to apply facts to delegated host instead of inventory\_hostname."

"Delegated facts  
By default, any fact gathered by a delegated task are assigned to the inventory\_hostname (the current host) instead of the host which actually produced the facts (the delegated to host). In 2.0, the directive delegate\_facts may be set to True to assign the task’s gathered facts to the delegated host instead of the current one"

So it seams that delegate\_facts only work on gather facts, aka the setup module and not the set\_facts that set a fact on host.
