I currently have a “working” Packer QEME windows build utilizing WinRM. I was reviewing the ansible documentation and realized that the method in which im calling ansible is making use of the custom connection_plugin which is now “Not Recommended”: Ansible - Provisioners | Packer by HashiCorp
I’m trying to convert my otherwise working playbook to the documentation’s “Preferred” method - but it’s not working
Abridged JSON
{
“builders”: [
{
"accelerator": "kvm",
"boot_wait": "5m",
"communicator": "winrm",
"disk_interface": "virtio",
"disk_size": "30G",
"floppy_dirs": [
"{{user `kvm_os_driver_path`}}"
],
"floppy_files": [
"{{user `autounattend`}}",
"{{user `pre_ansible_script`}}",
"{{user `pre_ansible_script_remoting_vendor`}}"
],
"format": "qcow2",
"headless": true,
"http_directory": "{{user `kvm_guest_agent_directory`}}",
"iso_checksum": "{{user `iso_checksum_type`}}:{{user `iso_checksum`}}",
"iso_url": "{{user `iso_url`}}",
"net_device": "virtio-net",
"output_directory": "{{user `output_directory`}}",
"qemuargs": [
[
"-m",
"5120M"
],
[
"-smp",
"cores=4,sockets=1"
],
[
"-cpu",
"host"
]
],
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Build SysPrep Shutdown\"",
"type": "qemu",
"vm_name": "{{user `vm_name`}}",
"winrm_password": "{{user `winrm_password`}}",
"winrm_timeout": "12h",
"winrm_username": "{{user `winrm_username`}}",
"winrm_no_proxy": true,
"winrm_port": 5985
}
],
“provisioners”: [
{
"elevated_password": "{{user `winrm_password`}}",
"elevated_user": "{{user `winrm_username`}}",
"environment_vars": [
"HTTPFILENAME={{user `kvm_guest_agent_filename`}}"
],
"inline": [
"Write-Output \"PACKER_HTTP_ADDR for this build is: http://$env:PACKER_HTTP_ADDR\"",
"Write-Output \"HTTPFILENAME for this build is: $env:HTTPFILENAME\"",
"Write-Output \"Full Download URI is: http://$env:PACKER_HTTP_ADDR/$env:HTTPFILENAME\"",
"Write-Output \"Full Download Destination is: C:\\$env:HTTPFILENAME\"",
"Invoke-WebRequest -Uri \"http://$env:PACKER_HTTP_ADDR/$env:HTTPFILENAME\" -OutFile \"C:\\$env:HTTPFILENAME\""
],
"type": "powershell"
},
{
"extra_arguments": [
"-vvvvv"
],
"playbook_file": "ansible/initial_config.yaml",
"type": "ansible",
"use_proxy": false,
"user": "{{user `winrm_username`}}",
"pause_before": "30s",
"keep_inventory_file" true
},
"variables": {
"autounattend": "answer_files/Server2016Standard/Autounattend.xml",
"final_imagename": "server2016_image_lab_build",
"floppy_buildfiles": "/var/build",
"iso_checksum": "186f55d26f4e9b60f8616b5485080a30baba6f82",
"iso_checksum_type": "sha1",
"iso_url": "http://my/path/to/media",
"kvm_guest_agent_directory": "/usr/share/virtio-win/guest-agent",
"kvm_guest_agent_filename": "qemu-ga-x86_64.msi",
"kvm_os_driver_path": "/usr/share/virtio-win/drivers/amd64/Win2016",
"output_directory": "/var/images/PROD_2016Build_{{isotime \"2006-Jan-02_15\"}}",
"pre_ansible_script": "scripts/payx_preansiblebuildsteps.ps1",
"pre_ansible_script_remoting_vendor": "scripts/ConfigureRemotingForAnsible.ps1",
"previous_imagename": "server2016_image_lab_build_previous",
"vm_name": "PROD_2016Build_{{isotime \"2006-Jan-02_15\"}}",
"winrm_password": "temppassword12345",
"winrm_username": "tmp_user"
}
}
Abridged Logs:
2021/02/25 15:09:32 packer-builder-qemu plugin: [INFO] Attempting WinRM connection…
2021/02/25 15:09:32 packer-builder-qemu plugin: [DEBUG] connecting to remote shell using WinRM
2021/02/25 15:09:32 packer-builder-qemu plugin: [ERROR] connection error: http response error: 401 - invalid content type
2021/02/25 15:09:32 packer-builder-qemu plugin: [ERROR] WinRM connection err: http response error: 401 - invalid content type
2021/02/25 15:09:37 packer-builder-qemu plugin: [INFO] Attempting WinRM connection…
2021/02/25 15:09:37 packer-builder-qemu plugin: [DEBUG] connecting to remote shell using WinRM
2021/02/25 15:10:01 packer-builder-qemu plugin: Checking that WinRM is connected with: ‘powershell.exe -EncodedCommand aQBmACAAKABUAGUAcwB0AC0AUABhAHQAaAAgAHYAYQByAGkAYQBiAGwAZQA6AGcAbABvAGIAYQBsADoAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAKQB7ACQAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAPQAnAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAJwB9ADsAIABlAGMAaABvACAAIgBXAGkAbgBSAE0AIABjAG8AbgBuAGUAYwB0AGUAZAAuACIA’
2021/02/25 15:10:01 packer-builder-qemu plugin: [INFO] starting remote command: powershell.exe -EncodedCommand aQBmACAAKABUAGUAcwB0AC0AUABhAHQAaAAgAHYAYQByAGkAYQBiAGwAZQA6AGcAbABvAGIAYQBsADoAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAKQB7ACQAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAPQAnAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAJwB9ADsAIABlAGMAaABvACAAIgBXAGkAbgBSAE0AIABjAG8AbgBuAGUAYwB0AGUAZAAuACIA
2021-02-25T15:10:02-05:00: qemu: WinRM connected.
2021/02/25 15:10:02 packer-builder-qemu plugin: [INFO] command ‘powershell.exe -EncodedCommand aQBmACAAKABUAGUAcwB0AC0AUABhAHQAaAAgAHYAYQByAGkAYQBiAGwAZQA6AGcAbABvAGIAYQBsADoAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAKQB7ACQAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAPQAnAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAJwB9ADsAIABlAGMAaABvACAAIgBXAGkAbgBSAE0AIABjAG8AbgBuAGUAYwB0AGUAZAAuACIA’ exited with code: 0
2021-02-25T15:10:02-05:00: ==> qemu: #< CLIXML
2021-02-25T15:10:02-05:00: ==> qemu: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 1Preparing modules for first use.0-1-1Completed-1
2021/02/25 15:10:02 packer-builder-qemu plugin: Connected to machine
2021-02-25T15:10:02-05:00: ==> qemu: Connected to WinRM!
2021/02/25 15:10:02 packer-builder-qemu plugin: Running the provision hook
2021/02/25 15:10:02 [INFO] (telemetry) Starting provisioner powershell
2021-02-25T15:10:02-05:00: ==> qemu: Provisioning with Powershell…
2021/02/25 15:10:02 packer-provisioner-powershell plugin: Found command: Write-Output “PACKER_HTTP_ADDR for this build is: http://$env:PACKER_HTTP_ADDR”
2021/02/25 15:10:02 packer-provisioner-powershell plugin: Found command: Write-Output “HTTPFILENAME for this build is: $env:HTTPFILENAME”
2021/02/25 15:10:02 packer-provisioner-powershell plugin: Found command: Write-Output “Full Download URI is: http://$env:PACKER_HTTP_ADDR/$env:HTTPFILENAME”
2021/02/25 15:10:02 packer-provisioner-powershell plugin: Found command: Write-Output “Full Download Destination is: C:$env:HTTPFILENAME”
2021/02/25 15:10:02 packer-provisioner-powershell plugin: Found command: Invoke-WebRequest -Uri “http://$env:PACKER_HTTP_ADDR/$env:HTTPFILENAME” -OutFile “C:$env:HTTPFILENAME”
2021-02-25T15:10:02-05:00: ==> qemu: Provisioning with powershell script: /tmp/powershell-provisioner254325923
2021/02/25 15:10:02 packer-provisioner-powershell plugin: Opening /tmp/powershell-provisioner254325923 for reading
2021/02/25 15:10:02 packer-provisioner-powershell plugin: Uploading env vars to c:/Windows/Temp/packer-ps-env-vars-603800f8-f4ca-bdaf-cedb-e55d73dbecf3.ps1
2021/02/25 15:10:02 packer-provisioner-powershell plugin: [INFO] 205 bytes written for ‘uploadData’
2021/02/25 15:10:02 [INFO] 205 bytes written for ‘uploadData’
2021/02/25 15:10:02 packer-builder-qemu plugin: Uploading file to ‘c:/Windows/Temp/packer-ps-env-vars-603800f8-f4ca-bdaf-cedb-e55d73dbecf3.ps1’
2021/02/25 15:10:04 packer-builder-qemu plugin: #< CLIXML
2021/02/25 15:10:05 packer-builder-qemu plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 #< CLIXML
2021/02/25 15:10:05 packer-provisioner-powershell plugin: Building elevated command wrapper for: powershell -executionpolicy bypass “& { if (Test-Path variable:global:ProgressPreference){set-variable -name variable:global:ProgressPreference -value ‘SilentlyContinue’};. c:/Windows/Temp/packer-ps-env-vars-603800f8-f4ca-bdaf-cedb-e55d73dbecf3.ps1; &‘c:/Windows/Temp/script-603800f8-6c71-e34c-1690-b9e738867184.ps1’; exit $LastExitCode }”
2021/02/25 15:10:05 packer-provisioner-powershell plugin: Command [powershell -executionpolicy bypass “& { if (Test-Path variable:global:ProgressPreference){set-variable -name variable:global:ProgressPreference -value ‘SilentlyContinue’};. c:/Windows/Temp/packer-ps-env-vars-603800f8-f4ca-bdaf-cedb-e55d73dbecf3.ps1; &‘c:/Windows/Temp/script-603800f8-6c71-e34c-1690-b9e738867184.ps1’; exit $LastExitCode }” > %SYSTEMROOT%/Temp/packer-6038041d-4667-53e0-62c3-99cc91939733.out 2>&1] converted to [powershell -executionpolicy bypass “& { if (Test-Path variable:global:ProgressPreference){set-variable -name variable:global:ProgressPreference -value ‘SilentlyContinue’};. c:/Windows/Temp/packer-ps-env-vars-603800f8-f4ca-bdaf-cedb-e55d73dbecf3.ps1; &‘c:/Windows/Temp/script-603800f8-6c71-e34c-1690-b9e738867184.ps1’; exit $LastExitCode }” > %SYSTEMROOT%/Temp/packer-6038041d-4667-53e0-62c3-99cc91939733.out 2>&1] for use in XML string
2021/02/25 15:10:05 packer-provisioner-powershell plugin: Uploading elevated shell wrapper for command [powershell -executionpolicy bypass “& { if (Test-Path variable:global:ProgressPreference){set-variable -name variable:global:ProgressPreference -value ‘SilentlyContinue’};. c:/Windows/Temp/packer-ps-env-vars-603800f8-f4ca-bdaf-cedb-e55d73dbecf3.ps1; &‘c:/Windows/Temp/script-603800f8-6c71-e34c-1690-b9e738867184.ps1’; exit $LastExitCode }” > %SYSTEMROOT%/Temp/packer-6038041d-4667-53e0-62c3-99cc91939733.out 2>&1] to [C:/Windows/Temp/packer-elevated-shell-6038041d-44e8-43e7-5bf5-2f70c63aec60.ps1]
2021/02/25 15:10:05 packer-provisioner-powershell plugin: [INFO] 3512 bytes written for ‘uploadData’
2021/02/25 15:10:05 [INFO] 3512 bytes written for ‘uploadData’
2021/02/25 15:10:05 packer-builder-qemu plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 Uploading file to ‘C:/Windows/Temp/packer-elevated-shell-6038041d-44e8-43e7-5bf5-2f70c63aec60.ps1’
2021/02/25 15:10:06 packer-builder-qemu plugin: #< CLIXML
2021/02/25 15:10:07 packer-builder-qemu plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 #< CLIXML
2021/02/25 15:10:07 packer-provisioner-powershell plugin: [INFO] 399 bytes written for ‘uploadData’
2021/02/25 15:10:07 [INFO] 399 bytes written for ‘uploadData’
2021/02/25 15:10:07 packer-builder-qemu plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 Uploading file to ‘c:/Windows/Temp/script-603800f8-6c71-e34c-1690-b9e738867184.ps1’
2021/02/25 15:10:08 packer-builder-qemu plugin: #< CLIXML
2021/02/25 15:10:09 packer-builder-qemu plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 #< CLIXML
2021/02/25 15:10:10 packer-builder-qemu plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 [INFO] starting remote command: powershell -executionpolicy bypass -file “C:/Windows/Temp/packer-elevated-shell-6038041d-44e8-43e7-5bf5-2f70c63aec60.ps1”
2021-02-25T15:10:13-05:00: qemu: PACKER_HTTP_ADDR for this build is: http://10.0.2.2:8870
2021-02-25T15:10:13-05:00: qemu: HTTPFILENAME for this build is: qemu-ga-x86_64.msi
2021-02-25T15:10:13-05:00: qemu: Full Download URI is: http://10.0.2.2:8870/qemu-ga-x86_64.msi
2021-02-25T15:10:13-05:00: qemu: Full Download Destination is: C:\qemu-ga-x86_64.msi
2021/02/25 15:10:46 packer-builder-qemu plugin: [INFO] command ‘powershell -executionpolicy bypass -file “C:/Windows/Temp/packer-elevated-shell-6038041d-44e8-43e7-5bf5-2f70c63aec60.ps1”’ exited with code: 0
2021/02/25 15:10:46 packer-builder-qemu plugin: [INFO] RPC endpoint: Communicator ended with: 0
2021/02/25 15:10:46 [INFO] 226 bytes written for ‘stdout’
2021/02/25 15:10:46 [INFO] 0 bytes written for ‘stderr’
2021/02/25 15:10:46 [INFO] RPC client: Communicator ended with: 0
2021/02/25 15:10:46 [INFO] RPC endpoint: Communicator ended with: 0
2021/02/25 15:10:46 packer-provisioner-powershell plugin: [INFO] 226 bytes written for ‘stdout’
2021/02/25 15:10:46 packer-provisioner-powershell plugin: [INFO] 0 bytes written for ‘stderr’
2021/02/25 15:10:46 packer-provisioner-powershell plugin: [INFO] RPC client: Communicator ended with: 0
2021/02/25 15:10:46 packer-provisioner-powershell plugin: c:/Windows/Temp/script-603800f8-6c71-e34c-1690-b9e738867184.ps1 returned with exit code 0
2021/02/25 15:10:46 packer-provisioner-powershell plugin: [INFO] 511 bytes written for ‘uploadData’
2021/02/25 15:10:46 [INFO] 511 bytes written for ‘uploadData’
2021/02/25 15:10:46 packer-builder-qemu plugin: Uploading file to ‘c:/Windows/Temp/packer-cleanup-603800f8-dcd4-92fd-014b-4251c944613c.ps1’
2021/02/25 15:10:48 packer-builder-qemu plugin: #< CLIXML
2021/02/25 15:10:49 packer-builder-qemu plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 #< CLIXML
2021/02/25 15:10:49 packer-builder-qemu plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 [INFO] starting remote command: powershell -executionpolicy bypass “& { if (Test-Path variable:global:ProgressPreference){set-variable -name variable:global:ProgressPreference -value ‘SilentlyContinue’};. c:/Windows/Temp/packer-ps-env-vars-603800f8-f4ca-bdaf-cedb-e55d73dbecf3.ps1; &‘c:/Windows/Temp/packer-cleanup-603800f8-dcd4-92fd-014b-4251c944613c.ps1’; exit $LastExitCode }”
2021/02/25 15:10:50 [INFO] 0 bytes written for ‘stdout’
2021/02/25 15:10:50 [INFO] 0 bytes written for ‘stderr’
2021/02/25 15:10:50 packer-builder-qemu plugin: [INFO] command ‘powershell -executionpolicy bypass “& { if (Test-Path variable:global:ProgressPreference){set-variable -name variable:global:ProgressPreference -value ‘SilentlyContinue’};. c:/Windows/Temp/packer-ps-env-vars-603800f8-f4ca-bdaf-cedb-e55d73dbecf3.ps1; &‘c:/Windows/Temp/packer-cleanup-603800f8-dcd4-92fd-014b-4251c944613c.ps1’; exit $LastExitCode }”’ exited with code: 0
2021/02/25 15:10:50 packer-builder-qemu plugin: [INFO] RPC endpoint: Communicator ended with: 0
2021/02/25 15:10:50 [INFO] RPC client: Communicator ended with: 0
2021/02/25 15:10:50 [INFO] RPC endpoint: Communicator ended with: 0
2021/02/25 15:10:50 packer-provisioner-powershell plugin: [INFO] 0 bytes written for ‘stdout’
2021/02/25 15:10:50 packer-provisioner-powershell plugin: [INFO] 0 bytes written for ‘stderr’
2021/02/25 15:10:50 packer-provisioner-powershell plugin: [INFO] RPC client: Communicator ended with: 0
2021/02/25 15:10:50 [INFO] (telemetry) ending powershell
2021/02/25 15:10:50 [INFO] (telemetry) Starting provisioner ansible
2021-02-25T15:10:50-05:00: ==> qemu: Pausing 30s before the next provisioner…
2021-02-25T15:11:20-05:00: ==> qemu: Provisioning with Ansible…
2021-02-25T15:11:20-05:00: qemu: Not using Proxy adapter for Ansible run:
qemu: Using WinRM Password from Packer communicator…
qemu: Using WinRM Password from Packer communicator…
2021/02/25 15:11:20 packer-provisioner-ansible plugin: Creating inventory file for Ansible run…
2021-02-25T15:11:20-05:00: ==> qemu: Executing Ansible: ansible-playbook -e packer_build_name=“qemu” -e packer_builder_type=qemu -e packer_http_addr=10.0.2.2:8870 -vvvvv -e ansible_password=***** -i /tmp/packer-provisioner-ansible910873505 /opt/jenkins/workspace/plates_MDT_2016_imagebuild_PR-37@2/windows/ansible/initial_config.yaml
2021-02-25T15:11:22-05:00: qemu: ansible-playbook 2.9.16
2021-02-25T15:11:22-05:00: qemu: config file = /etc/ansible/ansible.cfg
2021-02-25T15:11:22-05:00: qemu: configured module search path = [u’/home/linux_eng/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
2021-02-25T15:11:22-05:00: qemu: ansible python module location = /usr/lib/python2.7/site-packages/ansible
2021-02-25T15:11:22-05:00: qemu: executable location = /bin/ansible-playbook
2021-02-25T15:11:22-05:00: qemu: python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
2021-02-25T15:11:22-05:00: qemu: Using /etc/ansible/ansible.cfg as config file
2021-02-25T15:11:22-05:00: qemu: setting up inventory plugins
2021-02-25T15:11:22-05:00: qemu: host_list declined parsing /tmp/packer-provisioner-ansible910873505 as it did not pass its verify_file() method
2021-02-25T15:11:22-05:00: qemu: script declined parsing /tmp/packer-provisioner-ansible910873505 as it did not pass its verify_file() method
2021-02-25T15:11:22-05:00: qemu: auto declined parsing /tmp/packer-provisioner-ansible910873505 as it did not pass its verify_file() method
2021-02-25T15:11:22-05:00: qemu: Parsed /tmp/packer-provisioner-ansible910873505 inventory source with ini plugin
2021-02-25T15:11:23-05:00: qemu: Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/default.pyc
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘actionable’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘actionable’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘aws_resource_actions’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘cgroup_memory_recap’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘cgroup_perf_recap’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘context_demo’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘counter_enabled’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘counter_enabled’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘debug’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘debug’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘dense’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘dense’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘dense’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘dense’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘foreman’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘full_skip’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘full_skip’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘grafana_annotations’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘hipchat’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘jabber’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘json’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘json’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘junit’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘log_plays’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘logdna’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘logentries’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘logstash’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘mail’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘minimal’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘minimal’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘nrdp’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘null’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘null’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘oneline’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘oneline’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘osx_say’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘profile_roles’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘profile_tasks’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘say’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘selective’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘selective’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘skippy’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘skippy’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘slack’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘splunk’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘stderr’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘stderr’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘sumologic’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘syslog_json’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘timer’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘tree’ callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘unixy’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘unixy’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu: Attempting to use ‘yaml’ callback.
2021-02-25T15:11:24-05:00: qemu: Skipping callback ‘yaml’, as we already have a stdout callback.
2021-02-25T15:11:24-05:00: qemu:
2021-02-25T15:11:24-05:00: qemu: PLAYBOOK: initial_config.yaml **************************************************
2021-02-25T15:11:24-05:00: qemu: Positional arguments: /opt/jenkins/workspace/plates_MDT_2016_imagebuild_PR-37@2/windows/ansible/initial_config.yaml
2021-02-25T15:11:24-05:00: qemu: become_method: sudo
2021-02-25T15:11:24-05:00: qemu: inventory: (u’/tmp/packer-provisioner-ansible910873505’,)
2021-02-25T15:11:24-05:00: qemu: forks: 5
2021-02-25T15:11:24-05:00: qemu: tags: (u’all’,)
2021-02-25T15:11:24-05:00: qemu: extra_vars: (u’packer_build_name=“qemu”’, u’packer_builder_type=qemu’, u’packer_http_addr=10.0.2.2:8870’, u’ansible_password=temppassword12345’)
2021-02-25T15:11:24-05:00: qemu: verbosity: 5
2021-02-25T15:11:24-05:00: qemu: connection: smart
2021-02-25T15:11:24-05:00: qemu: timeout: 10
2021-02-25T15:11:24-05:00: qemu: 1 plays in /opt/jenkins/workspace/plates_MDT_2016_imagebuild_PR-37@2/windows/ansible/initial_config.yaml
2021-02-25T15:11:24-05:00: qemu:
2021-02-25T15:11:24-05:00: qemu: PLAY [all] *********************************************************************
2021-02-25T15:11:24-05:00: qemu:
2021-02-25T15:11:24-05:00: qemu: TASK [Gathering Facts] *********************************************************
2021-02-25T15:11:24-05:00: qemu: task path: /opt/jenkins/workspace/plates_MDT_2016_imagebuild_PR-37@2/windows/ansible/initial_config.yaml:3
2021-02-25T15:11:24-05:00: qemu: Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/setup.ps1
2021-02-25T15:11:24-05:00: qemu: Pipelining is enabled.
2021-02-25T15:11:24-05:00: qemu: <127.0.0.1> ESTABLISH WINRM CONNECTION FOR USER: paychextmp on PORT 2697 TO 127.0.0.1
2021-02-25T15:11:24-05:00: qemu: <127.0.0.1> WINRM CONNECT: transport=basic endpoint=https://127.0.0.1:2697/wsman
2021-02-25T15:11:24-05:00: qemu: <127.0.0.1> WINRM CONNECTION ERROR: EOF occurred in violation of protocol (_ssl.c:618)
2021-02-25T15:11:24-05:00: qemu: Traceback (most recent call last):
2021-02-25T15:11:24-05:00: qemu: File “/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py”, line 415, in _winrm_connect
2021-02-25T15:11:24-05:00: qemu: self.shell_id = protocol.open_shell(codepage=65001) # UTF-8
2021-02-25T15:11:24-05:00: qemu: File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 157, in open_shell
2021-02-25T15:11:24-05:00: qemu: res = self.send_message(xmltodict.unparse(req))
2021-02-25T15:11:24-05:00: qemu: File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 234, in send_message
2021-02-25T15:11:24-05:00: qemu: resp = self.transport.send_message(message)
2021-02-25T15:11:24-05:00: qemu: File “/usr/lib/python2.7/site-packages/winrm/transport.py”, line 256, in send_message
2021-02-25T15:11:24-05:00: qemu: response = self._send_message_request(prepared_request, message)
2021-02-25T15:11:24-05:00: qemu: File “/usr/lib/python2.7/site-packages/winrm/transport.py”, line 261, in _send_message_request
2021-02-25T15:11:24-05:00: qemu: response = self.session.send(prepared_request, timeout=self.read_timeout_sec)
2021-02-25T15:11:24-05:00: qemu: File “/usr/lib/python2.7/site-packages/requests/sessions.py”, line 596, in send
2021-02-25T15:11:24-05:00: qemu: r = adapter.send(request, **kwargs)
2021-02-25T15:11:24-05:00: qemu: File “/usr/lib/python2.7/site-packages/requests/adapters.py”, line 497, in send
2021-02-25T15:11:24-05:00: qemu: raise SSLError(e, request=request)
2021-02-25T15:11:24-05:00: qemu: SSLError: EOF occurred in violation of protocol (_ssl.c:618)
2021-02-25T15:11:24-05:00: qemu: fatal: [default]: UNREACHABLE! => {
2021-02-25T15:11:24-05:00: qemu: “changed”: false,
2021-02-25T15:11:24-05:00: qemu: “msg”: “basic: EOF occurred in violation of protocol (_ssl.c:618)”,
2021-02-25T15:11:24-05:00: qemu: “unreachable”: true
2021-02-25T15:11:24-05:00: qemu: }
2021-02-25T15:11:24-05:00: qemu:
2021-02-25T15:11:24-05:00: qemu: PLAY RECAP *********************************************************************
2021-02-25T15:11:24-05:00: qemu: default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
2021-02-25T15:11:24-05:00: qemu:
2021/02/25 15:11:24 [INFO] (telemetry) ending ansible
2021-02-25T15:11:24-05:00: ==> qemu: Error executing Ansible: Non-zero exit status: exit status 4
2021-02-25T15:11:24-05:00: ==> qemu: Step “StepProvision” failed
Comments:
I “know” Winrm is working - as it waits for winrm - then my powershell provisioner “works” successfully. The ansible one then fails. My hunch is it is not using the correct port (and using 5985 or something rather than the expected port (2697 in this case)
Is there any way to further debug this? im using “five v’s” on my ansible call - but nothing super helpful there.
Packer 1.6.6
qemu-system-x86-2.0.0-1.el7.6.x86_64
qemu-img-1.5.3-175.el7_9.1.x86_64
qemu-kvm-1.5.3-175.el7_9.1.x86_64
qemu-common-2.0.0-1.el7.6.x86_64
libvirt-daemon-driver-qemu-4.5.0-36.el7_9.3.x86_64
qemu-kvm-common-1.5.3-175.el7_9.1.x86_64
ipxe-roms-qemu-20180825-3.git133f4c.el7.noarch
[linux_eng@imagebuildw1 windows]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)