run this with debug mode set PACKER_LOG=1
checking the sequence I would assume the restart work but the exit code wasn;t 0, that could explain it started the clean up process if you run this in debug mode, we should be able to see more, like the exit code before the clean up process alvaro On Sat, Mar 31, 2018 at 3:05 AM, Sim <[email protected]> wrote: > ==>azure-arm: Provisioning with shell script: PackerUpload/join_domain.ps1 > azure-arm: WARNING: The changes will take effect after you restart the > computer tmppackervm. > ==> azure-arm: Pausing 6m0s before the next provisioner... > ==> azure-arm: Restarting Machine > ==> azure-arm: > ==> azure-arm: Cleanup requested, deleting resource group ... > > This is the console, it ran the DomainJoin script, but when it moved to > execute the windows_restart. It couldn't restart the VM because of the > timeout. I suspect it may be because of the domain_join script somehow > automatically restarted the VM after adding the VM into the domain or maybe > it was prompting something and waiting for user input. Not quite sure if > there is any ideas of how to optimise the domain_join script so it > wont restart the VM. Thank you. > > On Thursday, March 29, 2018 at 8:34:45 PM UTC+11, Alvaro Miranda Aguilera > wrote: >> >> Do you have any way to get to the console in AZURE and confirm the VM got >> restarted error free? >> >> Sometimes windows will use the restart to install some updates, etc. >> >> So checking the console may help. >> >> Alvaro >> >> >> On Thu, Mar 29, 2018 at 1:41 AM, Sim <[email protected]> wrote: >> >>> As I need to add the temporary VM which is generated by Packer during >>> the build into the domain, I have added a Domain join powershell script >>> into the template which looks like this: >>> >>> $domain = "xxxxx" >>> $password = "xxxxx" | ConvertTo-SecureString -asPlainText -Force >>> $username = "$domain\aaa.bbb" >>> $credential = New-Object System.Management.Automation.P >>> SCredential($username,$password) >>> Add-Computer -DomainName $domain -Credential $credential >>> >>> and then in the provisioners part of the template, I placed the domain >>> join script before the windows-restart command. >>> >>> { >>> "type": "powershell", >>> "script": "PackerUpload/join_domain.ps1" >>> }, >>> { >>> "type": "windows-restart", >>> "restart_check_command": "powershell -command \"& {Write-Output >>> 'restarted.'}\"" >>> } >>> >>> However, I don't know why the build failed because it was waiting for >>> the machine to restart. It did run the domain join script I believe. I even >>> did add some "windows_restart" params in the packer template like: >>> "pause_before": "60s", >>> "restart_timeout": "10m", >>> >>> still didn't work, it still kept waiting and failed to continue to run >>> other parts in the template. >>> >>> Has anyone encountered this issue before? Thank you. >>> >>> -- >>> This mailing list is governed under the HashiCorp Community Guidelines - >>> https://www.hashicorp.com/community-guidelines.html. Behavior in >>> violation of those guidelines may result in your removal from this mailing >>> list. >>> >>> GitHub Issues: https://github.com/mitchellh/packer/issues >>> IRC: #packer-tool on Freenode >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Packer" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit https://groups.google.com/d/ms >>> gid/packer-tool/54b84fbc-4c02-4810-b0df-0e483a8ee981%40googlegroups.com >>> <https://groups.google.com/d/msgid/packer-tool/54b84fbc-4c02-4810-b0df-0e483a8ee981%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Alvaro >> >> -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/packer-tool/8fa36ae6-afe6-4601-9d7c-1db1cb5e53b9%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/8fa36ae6-afe6-4601-9d7c-1db1cb5e53b9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Alvaro -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAHqq0ewFzhu10YUz0XFBoarB_1Y2EWjKLK23YVrrtvP%2Btmz0VQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
