# fetching hostvar for use elsewhere

**URL:** <https://forum.ansible.com/t/fetching-hostvar-for-use-elsewhere/35853>\
**Category:** Ansible Project\
**Created:** [October 12, 2021, 12:37pm UTC](https://forum.ansible.com/t/fetching-hostvar-for-use-elsewhere/35853 "2021-10-12T12:37:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 12, 2021, 12:37pm UTC](https://forum.ansible.com/t/fetching-hostvar-for-use-elsewhere/35853/1 "2021-10-12T12:37:37Z")

</div>

Hi

We’re using our ansible playbook/vars/etc also for other things/scripts/  
Sometimes we need those scripts to fetch a hostvar.  
Currently i’m using some kludgy construct like:

ANSIBLE\_STDOUT\_CALLBACK=json ansible -m debug -a var=composer\_version [login-uat.terena.org](http://login-uat.terena.org) | yq -r “.plays[0].tasks[0].hosts.composer\_version”

This does work but I was wondering if there is something better/simpler.

thx!

Dick
