Provision VM via Tower but see it as a VM on self portal


I’m trying to find the answer since days but I feel I have no luck.
I provision a VM on RHEV via Ansible Tower that is initiated from manageIQ, that part of the process works like a charm.

Now, I’d like that the customer sees his “tower” service as a VM with all the feature like the power option, console, snapshot etc etc…
How can I achieve that?

Thanks for your help



The only way is to attach provisioned VM to service after EMS refresh by automation method. VM object have “add_to_service” method for this. You need to somehow identify this virtual machine to map to the service. Maybe name it the same as a service.

Example code for attaching vms to services:


If I’m reading you correctly I should duplicate /System/Event/EmsEvent/RHEVM/USER_ADD_VM to my domain and in one of the instance field (I have no clue which point), I should point to a custom method that will link that VM to as Service?

Thanks a lot


If a new VM is created in RHV (even if created outside of ManageIQ), MIQ will discover it and it will appear in the MIQ inventory list of VMs. This normally happens within seconds of the VM being created. What you won’t get is any kind of VM ‘ownership’ by MIQ group or user; for this to happen you need to initiate the VM provisioning workflow from ManageIQ itself.

Are you initiating the VM provision from Tower itself, or from ManageIQ?

I think the best way to do this would be to create a service catalog item in ManageIQ to launch your Tower provisioning job, and then have a second workflow step to associate the new VM with the newly created ManageIQ service. This may well be easier using embedded Ansible as the playbook would automatically see {{ manageiq.service }} and {{ manageiq.api_token }} to make the association of the new VM with the new service.

There’s a neat video example here:

Yes I’m provisioning the VM from Tower and the Tower template is initiated from ManageIQ.

I follow your id, I should ansible to link the VM to my service using the two variables but I don’t know how… I looked at the link you provided but I’m not sure how this can help me.


That was the solution ! Thanks !