从Ansible下载Windows Server 2012 R2和AWS S3 [英] Windows Server 2012 R2 and AWS S3 Download from Ansible
问题描述
我正在尝试从具有IAM Role for EC2的AWS S3下载一些文件,但Ansible出现错误.其他Ansible win_ *模块效果很好.
I'm trying to download some files from AWS S3 with IAM Role for EC2 but Ansible is getting an error. Other Ansible win_* modules works great.
Windows Server具有Python2和Python3,以及boto和boto3模块. Cmd正在响应python命令.执行时会打开Python3.在打开Python3时,我还测试了"import boto"命令,以确保已安装该模块.
Windows Server has Python2 and Python3, and also boto and boto3 modules. Cmd is responding to python command. It opens Python3 when it is executed. I also tested the 'import boto' command when the Python3 is opened to be sure that module is installed.
Ansible Playbook的配置如下:
Ansible Playbook is configured like:
- name: test s3 module
hosts: windows
tasks:
- name: get s3 file
aws_s3:
bucket: drktests3
object: /test
dest: C:\tests3.txt
mode: get
当我运行此配置时,输出如下:
When i run this configuration, the output is like that:
root@ip-172-31-22-4:/etc/ansible/playbooks# ansible-playbook s3test
PLAY [test s3 module] *******************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************
ok: [38.210.201.10]
TASK [get s3 file] **********************************************************************************************************************************************
[WARNING]: FATAL ERROR DURING FILE TRANSFER:
fatal: [38.210.201.10]: 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\n\nstderr ANSIBALLZ_WRAPPER : The term 'ANSIBALLZ_WRAPPER' is not recognized as the name \r\nof a cmdlet, function, script file, or operable program. Check the spelling of \r\nthe name, or if a path was included, verify that the path is correct and try \r\nagain.\r\nAt line:1 char:1\r\n+ ANSIBALLZ_WRAPPER = True # For test-module script to tell this is a \r\nANSIBALLZ_WR ...\r\n+ ~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (ANSIBALLZ_WRAPPER:String) [], C \r\n ommandNotFoundException\r\n + FullyQualifiedErrorId :
如果我将hosts值更改为localhost,则该脚本可在主服务器(Linux Ubuntu)上运行.为什么Ansible无法在Windows服务器上执行python代码?
The same script works on the Master server(Linux Ubuntu) if i change the hosts value to localhost. Why Ansible cannot execute the python code on the Windows server?