Hi All,

*configuration:*
*Packer v 1.4.0*
*Azure Builder*

I have worked with Packer a bit in the past but not specifically a domain 
joined packer run.  Has anyone been able to get a Packer run to work while 
joining a domain?  

I have all of my logic written in Chef and in the Packer run, I just 
execute the Chef code. My test kitchen in Chef works fine and can keep 
going after I've joined the domain but Packer can't seem to continue.  

Both Chef and Packer use winrm to communicate but there has to be *some* 
difference if Chef is able to make sense of the domain join but Packer 
cannot.  Unfortunately, I haven't been able to figure out that difference.

After the domain join occurs, we have to run a windows_restart for the 
changes to take effect but the Packer run never recovers.  Even though the 
machine is up and running (I can log into as the domain account) Packer 
doesn't pick up that it is available.  Here is the debug log showing some 
output from the powershell script that runs to join the domain, the windows 
restart is initiated properly but never recovers and throws 401 invalid 
content until the windows-restart times out.


019/05/13 10:36:05 ui:     azure-arm: VERBOSE: Performing the operation "Join 
in domain 'mydomain.com'" on target
2019/05/13 10:36:05 ui:     azure-arm:  "pkrvm4hxw4n4f89".
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] command 'powershell 
-executionpolicy bypass -file 
"C:/Windows/Temp/packer-elevated-shell-5cd980cd-a187-c086-26f2-8d764c3484ff.ps1"'
 
exited with code: 0
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] RPC endpoint: 
Communicator ended with: 0
2019/05/13 10:36:08 [INFO] 313 bytes written for 'stdout'
2019/05/13 10:36:08 [INFO] 0 bytes written for 'stderr'
2019/05/13 10:36:08 ui:     azure-arm: HasSucceeded ComputerName
2019/05/13 10:36:08 [INFO] RPC client: Communicator ended with: 0
2019/05/13 10:36:08 [INFO] RPC endpoint: Communicator ended with: 0
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] 313 bytes 
written for 'stdout'
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] 0 bytes written 
for 'stderr'
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] RPC client: 
Communicator ended with: 0
2019/05/13 10:36:08 ui:     azure-arm: ------------ ------------
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 Error in Ui.Message RPC 
call: connection is shut down
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 Error in Ui.Message RPC 
call: connection is shut down
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 Error in Ui.Message RPC 
call: connection is shut down
2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 Error in Ui.Message RPC 
call: connection is shut down
2019/05/13 10:36:08 [INFO] (telemetry) ending powershell
2019/05/13 10:36:08 [INFO] (telemetry) Starting provisioner windows-restart
2019/05/13 10:36:08 ui: ==> azure-arm: Pausing 2m0s before the next 
provisioner...
2019/05/13 10:38:08 ui: ==> azure-arm: Restarting Machine
2019/05/13 10:38:09 [INFO] 0 bytes written for 'stderr'
2019/05/13 10:38:09 [INFO] 0 bytes written for 'stdout'
2019/05/13 10:38:09 packer.exe: 2019/05/13 10:38:09 [INFO] 0 bytes written 
for 'stderr'
2019/05/13 10:38:09 packer.exe: 2019/05/13 10:38:09 [INFO] 0 bytes written 
for 'stdout'
2019/05/13 10:38:09 packer.exe: 2019/05/13 10:38:09 Retryable error: http 
response error: 401 - invalid content type
2019/05/13 10:38:12 [INFO] 0 bytes written for 'stderr'
2019/05/13 10:38:12 [INFO] 0 bytes written for 'stdout'

windows-restart logic:
{
"type": "windows-restart",
"restart_command": "shutdown -r -f -t 10 && net stop winrm",
"restart_check_command": "powershell -command \"& {Write-Output 
'restarted.'}\"",
"restart_timeout": "15m",
"pause_before": "2m"
},

My packer build has the following configured for winrm:
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_timeout": "5m",
"winrm_username": "packer"

I've tried to increase the timeout and updating winrm settings such as (but 
no luck): 
winrm set winrm/config/service @{AllowUnencrypted="true"}

Any ideas or help would be appreciated, thanks for taking the time to read 
this.

-- 
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/4a7024b1-6f7f-469f-89aa-e2122189d1cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to