while this approach probably works, i'm not sure how to help you here.
what i typically do is use the add_host module. something like this:
- name: some playbook that does things
hosts: localhost
connection: local
...
...
...
tasks:
- name: add host to in memory inventory
add_host: hostname="new-vm{{some_var}}" ansible_ssh_host={{ vmware_guest_facts['guest_primary_ipaddress']}} ansbile_ssh_port=22
- name: some new playbook that does the work
hosts: "new-vm{{some_var}}
become: yes
tasks:
- name: copy some file
template: src={{src}} dest={{dest}}
i typed this without checking it's yaml syntax etc, but should give you a rough idea of the approach we use.
Dann