Indicator for when VM base os install has completed?

Warren Head

Active Member
May 6, 2017
4
0
41
55
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 ?