fetching hostvar for use elsewhere

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 | yq -r “.plays[0].tasks[0].hosts.composer_version”

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

thx!

Dick