Proxmox VM provisioning with ansible - how to run task on created vm?

Hi,

I want to create a role that would do all of this tasks:

  1. Create vm from template with preconfigured IP address

  2. Modify vm parameters

  3. Power up and wait for vm to be network reachable

  4. Connect to newly created vm through template hardcoded IP and change its network settings

Now i don’t want a static entry in inventory of vm template name and its ip as i want it both to be configured as role variable - in hosts i have specified only hypervisors IPs which it should run 1-3 tasks on but obviously the 4th task should be run on newly created VM reachable by templates IP.

How can i make the 4th task run solely on the new vm?

What would we the best possible route to achieve this?

Hi

I currently have the Following Playbook that creates Windows Virtual Machines:
If you need to do other tasks on the Virtual Machine; I’ll recommend creating a Pipeline within a CI/CD platform:

For Example:
I have a number of Tasks

  • Create Machine
  • Create AD Object
  • Join Domain
  • Install Applications On Server
  • Update SCCM
  • Configure Second HardDrive on machine if Requested in Form:
  • Add DSC Agent onto Server

Tasks 4 will be Taken Care for you if you set AutoLogin:

`