Multiple Windows reboots with a provisioner

148 views
Skip to first unread message

rsjo...@gmail.com

unread,
Nov 13, 2017, 8:11:58 AM11/13/17
to Packer
Im trying to understand how / with which provisioners i can orchestrate multiple reboots (Windows only) and have packer continue to run. My use case is installing ~20 applications inside of the windows guest and many of those packages will require a reboot. Since i dont always know what those ~20 apps are i dont have the luxury of being able to use windows-restart provisioner and grouping my app installs.

I don't care what provisioner i use (ansible, shell, powershell etc.) i just need som way of having packer not think something has gone wrong when WinRM is no longer responding for a certain period of time.
I had hoped something like expect_disconnect (https://www.packer.io/docs/provisioners/shell.html#expect_disconnect) could be used but i can't find that anywhere in a provisioner i can use for Windows?

Currently my provisioners are split into 2:

    "provisioners": [
     
{
       
"type":  "ansible",
       
"playbook_file": "ansible/win2016std.yml",
       
"groups": ["windows"],
       
"extra_arguments": [
         
"--connection", "packer",
         
"--extra-vars", "ansible_shell_type=powershell ansible_shell_executable=None"
       
]
     
},
     
{
       
"type": "powershell",
       
"script": "scripts/my_script.ps1"
     
}
   
]


however rebooting inside Ansible seems to be a known issue and if i issue one or multiple reboots inside the powershell provisioner (my_script.ps1) i can't find a way to make Packer wait for either a timeout or a signal before it continues.

thanks
Reply all
Reply to author
Forward
0 new messages