Hi Guys,
I would really welcome some help and input regarding the above in my lab.
I have a server with the file and the path is correct, as well as the
username and pass.
This is the playbook:
# copy files
- hosts: windows
tasks:
- name: copy files from share
win_copy:
src: \\2019-ANSIBLE\c$\share\certnew.cer
dest:
\\win19-ansible-2\c$\users\Administrator\Desktop\test\certnew.cer
remote_src: yes
vars:
ansible_become_user: Administrator
ansible_become_pass: ********
And Error:
Using module file
/usr/lib/python3/dist-packages/ansible/modules/windows/win_copy.ps1
Pipelining is enabled.
<win19-ansible-2.ansible-ad.net> ESTABLISH WINRM CONNECTION FOR USER:
[email protected] on PORT 5986 TO win19-ansible-2.ansible-ad.net
EXEC (via pipeline wrapper)
The full traceback is:
Access is denied
At line:305 char:15
+ if (-not (Test-Path -LiteralPath $src)) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied:
(\\2019-ANSIBLE\c$\share\certnew.cer:String) [Test-Path],
UnauthorizedAccessException
+ FullyQualifiedErrorId :
ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.TestPathCommand
ScriptStackTrace:
at <ScriptBlock>, <No file>: line 305
System.UnauthorizedAccessException: Access is denied --->
System.ComponentModel.Win32Exception: Access is denied
--- End of inner exception stack trace ---
at Microsoft.PowerShell.Commands.FileSystemProvider.ItemExists(String
path, ErrorRecord& error)
fatal: [win19-ansible-2.ansible-ad.net]: FAILED! => {
"changed": false,
"dest":
"\\\\win19-ansible-2\\c$\\users\\Administrator\\Desktop\\test\\certnew.cer",
"msg": "Unhandled exception while executing module: Access is denied",
"src": "\\\\2019-ANSIBLE\\c$\\share\\certnew.cer"
}
Looking at the ansible documents examples :
I also tried :
# copy files
- hosts: windows
tasks:
- name: copy files from share
win_copy:
src: C:\share\certnew.cer
dest: C:\users\Administrator\Desktop\test\certnew.cer
remote_src: yes
vars:
ansible_become_user: Administrator
ansible_become_pass: ********
and get:
fatal: [win19-ansible-2.ansible-ad.net]: FAILED! => {"changed": false,
"dest": "C:\\users\\Administrator\\Desktop\\test\\certnew.cer", "msg":
"Cannot copy src file: 'C:\\share\\certnew.cer' as it does not exist",
"src": "C:\\share\\certnew.cer"}
I'm stumped as the paths are correct and exist. Could anyone please help on
how you copy from one windows host to another?. As well as from a share on
one to another local path.
Much appreciated. Thank you
I tried that way above
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/401a52d0-e3b9-4383-972a-e4f74b6039bbn%40googlegroups.com.