Reputation: 1159
I been trying to copy a directory (in Linux) to a remote Windows node. I can copy single files without any issue. But when I been trying to copy a directory getting the following error.
Environment: Windows 7
Command: ansible --verbose Windows -m copy -a "src=~/Releases dest=C:\Ansible"
Error:
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
Upvotes: 2
Views: 1877
Reputation: 1159
Yes, totally agree with Bruce.
I have found this VERY useful module which is copy.ps1
https://gist.github.com/tkinz27/fd92ba9af0e0309614ee
And then things got working :-)
Important: You gotta upgrade your Windows (7) Powershell to Version 4.0
And yes it's really good to see new windows functionalists for Ansible.
Upvotes: 3
Reputation: 20719
Ansible currently has a fairly limited set of modules for Windows, and I don't believe that the copy module is supported for Windows systems. Windows versions of the copy, file, and template modules were recently accepted into the ansible-modules-core project on github. It looks like they depend on a separate pull request into ansible itself, and it's apparently slated to be available in ansible 1.9. The modules will be named win_copy, win_file, and win_template when they become available.
Upvotes: 2