The host
host1.example.com is listed in both group A and group B - the only difference is the value of the variable ‘lhost’. Ansible is executing on the correct host,
host1.example.com, but with the variable value from the list ing group B. See
https://docs.ansible.com/ansible/devel/user_guide/intro_inventory.html#how-variables-are-merged for information on how Ansible applies variable values.
If that’s a typo and they are different hosts, just correct the inventory entries and the problem will solve itself. If for some reason you want two entries in your inventory for hte same host, you can still give them different aliases - host1on1010 and host1on22010. Or you can store the variable values in a playbook or vars file and select the correct one at run time.
Hope this helps,
Alicia