Retirement behavior

Hi, I am just getting started with the automate model… I will be working on my own home lab and all my VMs have been discovered by MIQ and working quite nicely. One thing that is a bit beyond me yet is what happens when a VM retires. I want to make sure that MIQ does not ever delete a VM when it retires (I have some fairly important VMs in my VMware cluster) Could you confirm that is the case and that there is no way that MIQ would ever archive a retired machine in its default settings? I am using Gaprindashvili


I think by default VMs that already existed and were not provisioned by MIQ will not have a retirement date set and thus will exist until you manually retire them. You can check to be certain by looking at the VMs and seeing what the value for retirement date is, which will likely be never.

Going forward you may wish to edit the automate code to control how the process for automated retirement works with something like the following. I inserted this into the start_retirement method and it essentially skips the retirement for machines with a custom tag of retirement type (category) protected, and just sends an email warning users that the machine is end-of-life but it won’t delete it or power it down.

# Custom handling for VMs with protected retirement
if vm.tagged_with?("retirement_type", "protected")
  $evm.log("info", "VM [#{}] is tagged as having protected retirment, logging Service Desk ticket")
  # Set VM to never retire
  $evm.root['vm'].retires_on = nil
  $evm.root['vm'].retirement_warn = nil
  # Log ticket with the Service Desk
  mail_subject = "Private Cloud - Decommission  #{}"
  mail_body = "Virtual machine [#{}] has been marked for decommissioning as either the owners have "
  mail_body += "failed to renew the machine's licence, or the retirement process has been manually invoked by some user."
  mail_body += "<br><br>Please contact the relevant parties to check whether it is safe power down and fully decommission this VM."
  $evm.execute(:send_email, "", "", mail_subject, mail_body)
  # Break from retirement process
  exit MIQ_ABORT


Yes, I realise my current VMs do not have retirement dates, but will be manually setting these and myself owner to prompt upgrading as best practice for EoL OS’s to prompt upgrading. etc. What you have provided is what I wanted and will get me further along with the automate model. Thanks!



You can override retirement workflow to not remove VMs but only shutdown and mark/tag them. After this you can create reports to analyze which VMs are not used.

Thank you. Due to constant work over the last couple of weeks reading and doing from the Automation book, I think I just about know how to do that now!