VM provisioning emails

euwe

#1

Hi there,
Could anybody tell me how to insert some properties of VM into the notification email after successful service provision:
I can do it for Vm.id, vm.name and retirement date, but I couldn’t find how can I add the IP address of VM.
Maybe it is very simple question, but I cannot find the answer. Sorry for this.


#2

The VM includes an ipaddresses property you would use. It is an array to support multiple IP addresses. If you want to include all you would do something like vm.ipaddresses.join(', ') or you could just take the first one: vm.ipaddresses.first

Having this data populated at the time the email is sent requires that the provider can obtain the IP from the VM and ManageIQ has collected it as part of the inventory.


#3

Good day Greg,
Thank you for your answer. I’ve tried to use
#{vm['ipaddresses.first']}
#{vm['ipaddresses']}, for example:

body += “VM ip: #{vm[‘ipaddresses.first’]}”

in Cloud - VM - Provisioning - email - MiqProvision_Complete method,
but I receive blank field in email like this:
VM ip:
I’d like to know how can I receive ip address property in the email notification? We need to send emails with provisioned vm’s properties, like vm id, vm name, vm power state e.t.c.


#4

Your example text is a little off. I would expect it

body += "VM ip: #{vm['ipaddresses'].first}"

or better still

body += "VM ip: #{vm.ipaddresses.first}"

Were you able to verify if the VM’s IP address is known to ManageIQ?

Having this data populated at the time the email is sent requires that the provider can obtain the IP from the VM and ManageIQ has collected it as part of the inventory.


#5

Thank you very much!

#{vm.ipaddresses.first} really helped me.
Thanks again!


#6

@gmccullough, I’m using #{vm.ipaddresses.first} but it shows nothing.


#7

@miiraheart That sounds like the data is not available in the database. You can check this by looking for the IP Addresses on the summary page of the VM in the UI.

For some providers I know the IP addresses are only available when the VMs are running.


#8

Thank you for your reply, the IP address are not showing on the summary page even though the vm is running and oVirt guest agent is installed on the vm.


#9

@mperina Can you help out here?