Cannot copy a file from S3 to a windows node. WinRM send_input failed error.

Hello Team,

I just started using Ansible and am having trouble in getting it to work with AWS S3. Could you please have a look at the output and help me understand what I did wrong?

I did a lot of research on the error but am failing to get a complete picture of the problem.

To lay the context: I have an ec2 2008R2 instance in a private subnet which uses a NAT gateway to download stuff. I have created the Ansible Control Machine in a different account and am able to ping and get system report of the windows instances through VPC Peering.

Any help would be greatly appreciated. Thank you :slight_smile:

Best,
Yash.

`

PLAY [testing config management] ******************************************************************************************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************************************************************************************************
ok: [x.x.x.x]

TASK [Simple GET operation] ***********************************************************************************************************************************************************************************
fatal: [x.x.x.x]: FAILED! => {“msg”: "winrm send_input failed; \nstdout: Unable to initialize device PRN\r\nUnable to initialize device PRN\r\nUnable to initialize device PRN\r\nUnable to initialize device PRN\r\nUnable to initialize device PRN\r\n\nstderr _ANSIBALLZ_WRAPPER : The term ‘_ANSIBALLZ_WRAPPER’ is not recognized as the \r\nname of a cmdlet, function, script file, or operable program. Check the \r\nspelling of the name, or if a path was included, verify that the path is \r\ncorrect and try again.\r\nAt line:1 char:1\r\n+ _ANSIBALLZ_WRAPPER = True # For test-module script to tell this is a \r\nANSIBALLZ_W …\r\n+ ~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (_ANSIBALLZ_WRAPPER:String) , \r\n CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nAt line:1 char:21\r\n+ def _ansiballz_main():\r\n+ ~\r\nAn expression was expected after ‘(’.\r\n + CategoryInfo : ParserError: (:slight_smile: , ParentContainsErrorRecordEx \r\n ception\r\n + FullyQualifiedErrorId : ExpectedExpression\r\n \r\nimport : The term ‘import’ is not recognized as the name of a cmdlet, \r\nfunction, script file, or operable program. Check the spelling of the name, or \r\nif a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ import os\r\n+ ~~~~~~\r\n + CategoryInfo : ObjectNotFound: (import:String) , CommandNotFo \r\n undException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term ‘import’ is not recognized as the name of a cmdlet, \r\nfunction, script file, or operable program. Check the spelling of the name, or \r\nif a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ import os.path\r\n+ ~~~~~~\r\n + CategoryInfo : ObjectNotFound: (import:String) , CommandNotFo \r\n undException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term ‘import’ is not recognized as the name of a cmdlet, \r\nfunction, script file, or operable program. Check the spelling of the name, or \r\nif a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ import sys\r\n+ ~~~~~~\r\n + CategoryInfo : ObjectNotFound: (import:String) , CommandNotFo \r\n undException\r\n + FullyQualifiedErrorId :

`

This is the yml file.

`

  • name: testing config management
    hosts: zags
    tasks:
  • name: Simple GET operation
    aws_s3:
    aws_access_key: “{{ lookup(‘env’,‘aws_key’) }}”
    aws_secret_key: “{{ lookup(‘env’,‘aws_secret’) }}”
    bucket: “ansibletestbucket”
    object: “IPS.txt”
    dest: “D:\IPS.txt”
    mode: get

`

You can’t run non PowerShell modules on a Windows host. You would have to set delegate_to: localhost on the task to download it to the Ansible controller then use win_copy to copy it across.

Thanks

Jordan

Thanks Jordan. This worked. :slight_smile: