Restart Windows as many times as needed.

237 views
Skip to first unread message

Miodrag Milić

unread,
Jun 14, 2016, 1:29:51 PM6/14/16
to Packer
Updates for any given windows OS require unknown number of restarts. Is there any way to allow this ? I am aware of the windows-restart provisioner but it requires that I know exact number of restarts. I could put something like this but looks awkward and still doesn't do the job necessarily: 

    windows-restart
    invoke-winupdate
    windows-restart
    invoke-winupdate
    ...    
    windows-restart
    invoke-winupdate

If I repeat this long enough eventually all updates will be installed, but I will probably have number of useless restarts. Any ideas ?

I think that single provisioner should have an option to restart windows and re-execute itself for this to work.
Message has been deleted

Lloyd Holman

unread,
Jun 22, 2016, 1:06:57 PM6/22/16
to Packer
Have you seen this? http://www.hurryupandwait.io/blog/creating-windows-base-images-for-virtualbox-and-hyper-v-using-packer-boxstarter-and-vagrant

Matt does a great job of explaining how he does this, I've done very similar recently and it does work well. Basically it's all down to handling the windows updates and reboot checks locally on the vm before handing back to packer by enabling winrm, it uses BoxStarter to orchestrate that piece and persist state through reboots. A fair few moving parts but a nice solution.

Reply all
Reply to author
Forward
0 new messages