如何解决ansible的Windows模块win_command或win_shell的特权升级问题
我正在用拳头砸墙,试图使用ansible中的win_shell和/或win_command远程访问Copy-Item。
请注意,我能够在ansible尝试管理的服务器上本地执行此操作。
这是最新的代码:
- name: Arg Testing - Win Command
win_command: powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -NonInteractive -
args:
stdin: Copy-Item –Path "{{ source_file_path }}" –Destination "\\{{ test_server }}\{{ drive_letter }}${{ folder_name1 + folder_name2 }}"
delegate_to: "{{ server1 }}"
这是我收到的错误:
fatal: [ansible_server -> server1]: FAILED! => {"changed": true,"cmd": "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -NonInteractive -","delta": "0:00:00.390641","end": "2020-08-11 04:22:08.804385","msg": "non-zero return code","rc": 1,"start": "2020-08-11 04:22:08.413743","stderr": "Copy-Item : Access is denied\r\nAt line:1 char:1\r\n+ Copy-Item –Path \"this.is.source.path\" –Dest ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : NotSpecified: (:) [Copy-Item],UnauthorizedAccessException\r\n + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.CopyItemCommand\r\n \r\n","stderr_lines": ["Copy-Item : Access is denied","At line:1 char:1","+ Copy-Item –Path \"this.is.source.path\" –Dest ...","+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"," + CategoryInfo : NotSpecified: (:) [Copy-Item],UnauthorizedAccessException"," + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.CopyItemCommand"," "],"stdout": "","stdout_lines": []}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。