Automatically Update VMs

cbermudez

New Member
Oct 13, 2022
2
0
1
So I have a bit of a dilemma where my company needs to update a very large number of VMs on a regular basis as these connect to customer networks. Right now this is done by manually powering up, ssh and powering down the machines but that's pretty cumbersome as that's my responsibility and eats up a day and a half of my week once a month. What I want to do is the following:
  1. Check VM Power State
    1. If VM is off, power on and wait 5 minutes
  2. SSH into machine and update
  3. Wait 20 minutes for VM to complete updates
    1. Power off if VM was originally off
  4. Move to next VM
The only issue I have with this is that the VMs have LUKS disk encryption so I would need a way to unlock the VMs before the steps above can actually run. I can't think of something off the top of my head but I'm hoping one of you might know something.
 
You can just script it in shell or do it with ansible/<name-your-favorite-automation-tool> for this. For the LUKS part you would of course need all the encryption keys, ssh into the PVE host cryptset luksOpen your necessary device and do all the rest.
 
So I have a bit of a dilemma where my company needs to update a very large number of VMs on a regular basis as these connect to customer networks. Right now this is done by manually powering up, ssh and powering down the machines but that's pretty cumbersome as that's my responsibility and eats up a day and a half of my week once a month. What I want to do is the following:
  1. Check VM Power State
    1. If VM is off, power on and wait 5 minutes
  2. SSH into machine and update
  3. Wait 20 minutes for VM to complete updates
    1. Power off if VM was originally off
  4. Move to next VM
The only issue I have with this is that the VMs have LUKS disk encryption so I would need a way to unlock the VMs before the steps above can actually run. I can't think of something off the top of my head but I'm hoping one of you might know something.
Hello,

I am actually about to solve a similar problem. Mine is about 50 Linux VMs and just today started to write a powershell script to iterate over all vms and update; including some sanity checks. But so far it is more a basic core and some important things are missing.
Did you make any progress?