gpt4 book ai didi

ansible - 无法使用 Ansible 复制模块复制目录

转载 作者:行者123 更新时间:2023-12-02 21:20:15 24 4
gpt4 key购买 nike

我一直在尝试将目录(在 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

最佳答案

是的,完全同意布鲁斯的观点。

我发现了这个非常有用的模块,即 copy.ps1

https://gist.github.com/tkinz27/fd92ba9af0e0309614ee

然后事情就开始了:-)

重要提示:您必须将 Windows (7) Powershell 升级到版本 4.0

是的,很高兴看到 Ansible 的新 Windows 功能主义者。

关于ansible - 无法使用 Ansible 复制模块复制目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28180552/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com