python 2.7 - Ansible to copy files between windows box using UNC path -


i'm trying use ansible install odbc driver, stored in share folder. however, seems leading slash "\\" cause parsing issue , ansible couldn't find file. i'm wondering there work around perform such task. have no problems execute copy command on target windows box , there shouldn't permission issues.

playbook:

--- # play-book part of vm checkout # job install sql odbc driver # job depends on access \\company\software\utilities - name: install sql odbc driver microsoft   hosts: '{{ remote_host }}'   tasks:   - name: fetch odbc driver share     win_shell: copy-item "\\company\\us410_software\\utilities\\msodbcsql_x64.msi" d:\software    - name: install odbc driver     win_msi:       path: d:\software\msodbcsql_x64.msi       wait: yes 

the error i'm getting:

"changed": true,     "cmd": "copy-item \"\\\\company\\\\us410_software\\\\utilities\\\\msodbcsql_x64.msi\" d:\\software",     "delta": "0:00:01.368157",     "end": "2017-08-14 08:25:41.869527",     "failed": true,     "rc": 1,     "start": "2017-08-14 08:25:40.501370",     "stderr": "copy-item : access denied\r\nat line:1 char:65\r\n+ [console]::inputencoding = new-object text.utf8encoding $false; copy-item \r\n\"\\\\820 ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n~~~\r\n    + categoryinfo          : permissiondenied: (\\\\company\\...odbcsql_x005f_x64 \r\n   .msi:string) [copy-item], unauthorizedaccessexception\r\n    + fullyqualifiederrorid : itemexistsunauthorizedaccesserror,microsoft.powe \r\n   rshell.commands.copyitemcommand\r\n \r\ncopy-item : cannot find path \r\n'\\\\company\\\\us410_software\\\\utilities\\\\msodbcsql_x005f_x64.msi' because \r\nnot exist.\r\nat line:1 char:65\r\n+ [console]::inputencoding = new-object text.utf8encoding $false; copy-item  

i think might need correct input to

win_shell: copy-item  "\\\\\\\\company\\\\us410_software\\\\utilities\\\\msodbcsql_x64.msi"  d:\software 

the slash special character inside quotes in yaml , double slashes converted single 1 need 4 of them denote start of typical unc path in yaml.

if doesn't solve it, suspect using kerberos authentication access windows machines ansible , hitting double hop problem. struggled same problem myself many days until found http://www.absolutejam.co.uk/blog/ansible-windows-credssp/ , switched credssp. solved issue , built-in ansible modules worked great after. no issues using unc paths in modules win_copy , win_file anymore.

follow directions in above link ready windows machines credssp use ansible documentation here http://docs.ansible.com/ansible/latest/intro_windows.html#credssp enable on server.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -