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.PSCredential($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/msgid/packer-tool/54b84fbc-4c02-4810-b0df-0e483a8ee981%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.