I may have misunderstood the above reply.
Example set-up:
inventories/prod/hosts
[a_server]
hostname1
[b_server]
hostname2
[c_server]
hostname3
inventories/prod/group_vars/a_server
databaseURL : URL_for_hostname1s_db
inventories/prod/group_vars/b_server
databaseURL : URL_for_hostname2s_db
inventories/prod/group_vars/c_server
databaseURL : URL_for_hostname3s_db
When I run the playbook --> ansible-playbook doTemplates.yml -i <full path>/inventories/prod/hosts -e target=b_server
I would expect the file resulting from the j2 to have "URL_for_hostname2s_db" however, it has "URL_for_hostname3s_db"
It looks like Ansible is loading the variables inside a_server, b_server, c_server even though I only specified b_server as the target.
Shouldn't Ansible load just b_server?