Indicator for when VM base os install has completed?

Warren Head

Active Member
May 6, 2017
4
0
41
54
Is there a solid indicator in proxmox I can use which can tell me when a base os install on a (new) virtual machine has been completed?
Preferably usable for scripting.

I want to use this for automated creation of multiple Debian vm's, by using ansible, the Proxmox API and Debian preseeding.

My current 'workaround' is going to be that I will have ansible poll the status of the vm through the api from the moment the vm is being started to install Debian, until the vm goes down for the first time, because the installation has finished.
That will work, but it is a bit flimsy.

Perhaps there is already an existing and more sturdy indicator?
 
not really, but can't you include a script in your debian preseed which executes/sets something on the host or similar?
 
I would poll from the host for instance if the ssh port or any non-installer port is open in the VM (this is how packer works)

if the ssh port is open then it means:
* installation is complete
* reboot has completed
* network services are active

ansible has facilities for that, for instance along the line of

[BLOCK]
- name: waiting for server to come back after a reboot
#starts polling the server after a 25 second delay, wait for 300 seconds
local_action:·
wait_for
host={{ ansible_ssh_host }}
port=22
state=started
delay=30
timeout=300
become: no
[/BLOCK]
 
Thanks for your answers.

My original preseed file had the default option of rebooting the machine after the install finished.
Unfortunately, because the kernel args were set and kept in the vm config, the vm was reinstalling in an endless loop.
So I had to change the preseed file to halt after the installation was done.
This fortunately gave me the option of querying when the vm was switching from on to off.
Indeed, with an ansible do until loop, I got that information.

After the machine has halted, I use an api call to change the vm config and remove the args flag.
And then I can safely start the machine again and start accessing it.

Problem solved.
 
just to make it 100% clear the VM config args you're talking about are the device boot order ?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!