Trying to use Packer Provisioner for Ansible, Winrm connections to Windows 2019 server

118 views
Skip to first unread message

i255d

unread,
Sep 28, 2020, 7:17:35 PM9/28/20
to Ansible Project
I have been working on this for days, and I feel like I am close.  Any ideas what is causing this???


    amazon-ebs: PLAYBOOK: playbook.yml *********************************************************
    amazon-ebs: 1 plays in /codebuild/output/src610977066/src/git.nylcloud.com/Cloud-Team/packer-aws-nyl-win2016/playbook.yml
    amazon-ebs:
    amazon-ebs: PLAY [all] *********************************************************************
    amazon-ebs:
    amazon-ebs: TASK [Gathering Facts] *********************************************************
    amazon-ebs: task path: /codebuild/output/src610977066/src/git.nylcloud.com/Cloud-Team/packer-aws-nyl-win2016/playbook.yml:2
    amazon-ebs: redirecting (type: modules) ansible.builtin.setup to ansible.windows.setup
    amazon-ebs: Using module file /root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/ansible_collections/ansible/windows/plugins/modules/setup.ps1
    amazon-ebs: Pipelining is enabled.
    amazon-ebs: <10.184.21.20> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 10.184.21.20
    amazon-ebs: EXEC (via pipeline wrapper)
    amazon-ebs: [WARNING]: ERROR DURING WINRM SEND INPUT - attempting to recover: WinRMError
    amazon-ebs: The pipe is being closed.  (extended fault data: {'transport_message': 'Bad
    amazon-ebs: HTTP response returned from server. Code 500', 'http_status_code': 500,
    amazon-ebs: 'wsmanfault_code': '232', 'fault_code': 's:Receiver', 'fault_subcode':
    amazon-ebs: 'w:InternalError'})
    amazon-ebs: fatal: [default]: FAILED! => {00s\u0000t\u0000a\u0000l\u0000l\u0000e\u0000d\u0000.\u0000\r\u0000\n\u0000"
    amazon-ebs: }
    amazon-ebs:
    amazon-ebs: PLAY RECAP *********************************************************************
    amazon-ebs: default                    : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
    amazon-ebs:

jbor...@gmail.com

unread,
Sep 28, 2020, 11:27:55 PM9/28/20
to Ansible Project
There is an error when trying to execute PowerShell causing the process to stop and subsequently close the stdin pipe that Ansible is writing to. Can you run with a higher verbosity so that Ansible shows the full stdout and stderr from the process (-vvvvvv). That will output the full error message which you can then subsequently remove the \u0000 as the text is UTF-16 encoded. This should give you a reason as to why the process has failed.

i255d

unread,
Sep 30, 2020, 1:11:17 AM9/30/20
to Ansible Project

i255d

unread,
Sep 30, 2020, 10:26:26 AM9/30/20
to Ansible Project
One of the Ansible engineers is suggesting the Packer may be doing something with an environmental variables 'POWERSHELL_VERSION' that may be causing this issue.      14:30 <@jborean93> i255d: https://github.com/ansible/ansible/blob/8f02819db02459ed144e131db3808dee0a7356db/lib/ansible/plugins... you have `POWERSHELL_VERSION` set in an env var which is causing the trouble

i255d

unread,
Sep 30, 2020, 12:02:44 PM9/30/20
to Ansible Project
added now:  I have a $PSversiontable in the powershell provisioner that shows it is version 5.1, when I switch the OS from 2019 to 2016, and the when the Ansible part runs is says this:      amazon-ebs: <10.184.21.18> WINRM EXEC 'PowerShell' ['-Version', '6.2.6', '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-EncodedCommand', 
I am pretty sure the version 6.2.6 is the issue.
Reply all
Reply to author
Forward
0 new messages