I have a dummy doubt that keeps me stuck for a long time. I have a very banal inventory file with hosts and variables:
[lb] 10.112.84.122 [tomcat] 10.112.84
If you want to refer one host define under /etc/ansible/host in a task or role, the bellow link might help:
https://www.middlewareinventory.com/blog/ansible-get-ip-address/