Cannot reach newly created Windows VM

I currently have a Workflow in Tower that does what I want, but it is doing so via a cumbersome method:

  • First playbook creates a VM

  • VMware Inventory sync

  • Run additional playbooks (that may now be targeting already configured Windows VMs) to configure settings and install apps.
    Ideally, all I REALLY want to do is:

  • Create the VM

  • Run the additional playbooks to configure settings and install apps – against ONLY the newly created VM.
    I have seen examples in many places where folks use add_host in playbooks that create new VMs/instances/etc so further actions can be taken.

I’m trying that as well, but cannot seem to get the Windows VM to be reachable via WinRM. Part of the ‘fun’ is that my VM is being customized and must first do the “OS Customization” reboot before Windows will have the correct IP and for the WinRM listener to be created. The code below is the playbook I’m currently running:

`

checkout https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#provisioning-callbacks

What’s the best method for a Windows machine to do a callback? PowerShell Run-once?

So, I discovered the powershell command to do this “invoke-webrequest” and it worked on a playbook as expected. However, the ‘inventory’ issue still remains – the machine has to BE in the inventory assigned to the job template or the callback won’t work.

I can obviously just add and inventory sync to the Workflow. However, I do NOT want that to run until I know the OS Customization pass is done and the machine (should) be done – otherwise, the inventory sync will capture the wrong IP information.

Is there a way to pause a play until a callback is made?