What is the right way to look up the IPv4 address (or addresses) associated with a host name from global_vars?
Here is the scenario. I use Postgres with Host-Based Authentication (HBA). In order to configure HBA, I need to put IP addresses of the permitted clients into the configuration file, but what I have as the input are host FQDNs that I need to resolve somehow. What would be the best way to do it in a Jinja2 template or within group_vars?
I tried to use Python socket.gethostbyname() but I could not get the syntax right.
Granted, I can fall back to a shell script and templetize it outside of Ansible/Jinja2 but I still hope to find a decent way to do it in Ansible.
Regards,
/Sergey