我一直在尝试将目录(在Linux中)复制到远程Windows节点。我可以毫无问题地复制单个文件。但是当我试图复制目录时出现以下错误。
环境:Windows 7
命令:ansible --verbose Windows -m copy -a“src =〜/ Releases dest = C:\ Ansible”
错误:
10.8.0.4 | FAILED => Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 561, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 666, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 884, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
File "/usr/lib/python2.7/dist-packages/ansible/runner/action_plugins/copy.py", line 252, in run
module_return = self.runner._execute_module(conn, tmp_path, 'copy', module_args_tmp, inject=inject, complex_args=complex_args, delete_remote_tmp=delete_remote_tmp)
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 483, in _execute_module
argsfile = self._transfer_str(conn, tmp, 'arguments', utils.jsonify(utils.parse_kv(args)))
File "/usr/lib/python2.7/dist-packages/ansible/utils/__init__.py", line 690, in parse_kv
vargs = split_args(args)
File "/usr/lib/python2.7/dist-packages/ansible/module_utils/splitter.py", line 182, in split_args
raise Exception("error while splitting arguments, either an unbalanced jinja2 block or quotes")
Exception: error while splitting arguments, either an unbalanced jinja2 block or quotes
答案 0 :(得分:3)
是的,完全同意布鲁斯的意见。
我发现这个非常有用的模块是copy.ps1
https://gist.github.com/tkinz27/fd92ba9af0e0309614ee
然后事情开始了: - )
重要提示:您必须将Windows(7)Powershell升级到版本4.0
是的,看到Ansible的新窗口功能主义者真的很棒。
答案 1 :(得分:1)
Ansible目前有一个相当limited set of modules for Windows,我不相信Windows系统支持复制模块。 Windows版本的副本,文件和模板模块recently accepted进入github上的ansible-modules-core项目。看起来它们依赖于单独的pull request into ansible本身,并且它显然可以在ansible 1.9中使用。这些模块在可用时将命名为win_copy,win_file和win_template。