# How to user hostvars

**URL:** <https://forum.ansible.com/t/how-to-user-hostvars/38287>\
**Category:** Ansible Project\
**Created:** [August 2, 2023, 6:54am UTC](https://forum.ansible.com/t/how-to-user-hostvars/38287 "2023-08-02T06:54:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olivier\_Studer1](https://avatars.discourse-cdn.com/v4/letter/o/9dc877/32.png) [@Olivier\_Studer1](https://forum.ansible.com/u/Olivier_Studer1)\
**Post date:** [August 2, 2023, 6:54am UTC](https://forum.ansible.com/t/how-to-user-hostvars/38287/1 "2023-08-02T06:54:28Z")

</div>

Hi,

I want to use hostvars to use a result of a task runing for on an host to apply this values/result to another host. The “register” can not be use because it is dedicated to the host, not sharing.

The goals is to active the Slave Mariadb server with the value from the Master server.

I think that I need to use the host-inventory (ini file) with this value. How can write this value ?

Thanks for your help

Regards  
Olivier

---

<div class="post-metadata">

**Author:** ![Pierre\_TOURON](https://avatars.discourse-cdn.com/v4/letter/p/b5a626/32.png) [@Pierre\_TOURON](https://forum.ansible.com/u/Pierre_TOURON)\
**Post date:** [August 7, 2023, 5:59pm UTC](https://forum.ansible.com/t/how-to-user-hostvars/38287/2 "2023-08-07T17:59:55Z")

</div>

Hi,

I’m pretty sure you could query facts cache to that end :

$ less test\_facts\_sharing.yml
