vsphere_guest provisioning and add_host module : problem on dynamic inventory VS static inventory

Hi Everyone,

I try to realise a playbook of autoprovisionning from scratch to “full installed application”
I use the “ansible inventory” for guide the provisionning

I use a lot of group who describe the configuration of the target:

if the entries (hostname) is in inventory ansible group “on-vmware” : the playbook use vsphere_guest module to create the host (by cloning) on a vmware cluster :

The cloning process is OK, my vm starts on a provisionning network => dhcp and vsphere_facts give to me IP adress of the new vm ( owing to vmtools).

my playbook :

Personally I wouldn't do this with roles, at least not for the
provisioning phase.

I haven't worked with the vsphere_guest module yet, but my suggestion is
to have 2 plays in your playbook: first provision, add the new VM to
your group, then a second play to configure the hosts (and apply roles).