I’m relatively new to Ansible, and still working these things out.
I have a setup where a Python script on the calling host runs a script against a configuration database, and returns a JSON hash of values. These values are to be fed into the playbook, to be used with whatever work needs to be done.
So far, I’ve tried putting the script call into a register variable, but that tries to call the script on each remote, where it will fail. I need the script to run on the host, before the playbook runs, and make the variable data available to the runs. I’m sure this kind of thing is done all the time, but combing through the Ansible docs hasn’t yet uncovered a solution.
Is this something that should be put into host variables? If so, how do I insert complex data from an external script into host variables?