Ansible 1.8.x does not support the copy module for windows hosts. A win_copy module was just merged into devel (which will become 1.9):
https://github.com/ansible/ansible-modules-core/pull/384 https://github.com/ansible/ansible/pull/9611 On Tuesday, December 16, 2014, Jeffrey Liu <[email protected]> wrote: > Hi All, > > I'm running Ansible 1.8.2 on a CentOS 6.6 server. > > I'm trying to copy a file to a windows host, but the copy module fails. > The weird thing is that I do see that it does PUT the file over to the > remote windows host, but it fails when it tries to execute the powershell > to rename the file to the destination directory. > If I abort the command before it removes the temporary files I can confirm > the remote "source" file is the actual file. It looks like the failure is > on the remote end to rename the file. Any ideas if this can be fixed? > It's a rather important feature for me to be able to distribute powershell > scripts for remote execution. > > Thanks! > > > [jklee@l99app09 poc]$ cat testcopy.yml > # ansible-playbook -i hosts testcopy.yml > --extra-vars="source='list-installed-programs.ps1' > d='C:\Users\jklee\list-installed-programs.ps1'" > --- > - hosts: windowsTest > gather_facts: false > tasks: > - name: Test copy > #copy: src=files/NewRelicServerMonitor_x64_3.3.2.0.msi > dest=C:\Users\Administrator\NewRelicServerMonitor_x64_3.3.2.0.msi > copy: src="{{ source }}" dest="{{ d }}" > > > [jklee@l99app09 poc]$ ansible-playbook -i hosts testcopy.yml > --extra-vars="source='list-installed-programs.ps1' > d='C:\Users\jklee\list-installed-programs.ps1'" > -vvv > > PLAY [windowsTest] > ************************************************************ > > TASK: [Test copy] > ************************************************************* > <w99app01.cloudapp.net> ESTABLISH WINRM CONNECTION FOR USER: jklee on > PORT 5986 TO w99app01.cloudapp.net > <w99app02.cloudapp.net> ESTABLISH WINRM CONNECTION FOR USER: jklee on > PORT 5986 TO w99app02.cloudapp.net > <w99app02.cloudapp.net> EXEC I f ( T e s t - P a t h - P a t h T y p > e L e a f " C : \ U s e r s \ j k l e e \ l i s t - i n s t a l l e d - > p r o g r a > m s . p s 1 " ) { $ s p = n e w - o b j e c t - T y p e N a m e > S y s t e m . S e c u r i t y . C r y p t o g r a p h y . S H A 1 C r y p > t o S e r > v i c e P r o v i d e r ; $ f p = [ S y s t e m . I O . F i l e ] : > : O p e n ( " C : \ U s e r s \ j k l e e \ l i s t - i n s t a l l e d - p > r o g r a > m s . p s 1 " , [ S y s t e m . I O . F i l e m o d e ] : : O p e n , > [ S y s t e m . I O . F i l e A c c e s s ] : : R e a d ) ; [ S y s t e m > . B i t C > o n v e r t e r ] : : T o S t r i n g ( $ s p . C o m p u t e H a s h ( $ > f p ) ) . R e p l a c e ( " - " , " " ) . T o L o w e r ( ) ; $ f p . D > i s p o s > e ( ) ; } E l s e I f ( T e s t - P a t h - P a t h T y p e C o > n t a i n e r " C : \ U s e r s \ j k l e e \ l i s t - i n s t a l l e d > - p r o g > r a m s . p s 1 " ) { W r i t e - H o s t " 3 " ; } E l s e { > W r i t e - H o s t " 1 " ; } > <w99app02.cloudapp.net> EXEC ( N e w - I t e m - T y p e D i r e c t > o r y - P a t h $ e n v : t e m p - N a m e " a n s i b l e - t m p > - 1 4 1 8 7 > 4 0 6 2 8 . 9 2 - 1 2 6 1 9 3 3 3 7 8 5 5 5 4 3 " ) . F u l l N a m e | > W r i t e - H o s t - S e p a r a t o r ' ' ; > <w99app02.cloudapp.net> PUT /home/jklee/poc/list-installed-programs.ps1 > TO > C:\Users\jklee\AppData\Local\Temp\ansible-tmp-1418740628.92-126193337855543\source > <w99app01.cloudapp.net> EXEC I f ( T e s t - P a t h - P a t h T y p > e L e a f " C : \ U s e r s \ j k l e e \ l i s t - i n s t a l l e d - > p r o g r a > m s . p s 1 " ) { $ s p = n e w - o b j e c t - T y p e N a m e > S y s t e m . S e c u r i t y . C r y p t o g r a p h y . S H A 1 C r y p > t o S e r > v i c e P r o v i d e r ; $ f p = [ S y s t e m . I O . F i l e ] : > : O p e n ( " C : \ U s e r s \ j k l e e \ l i s t - i n s t a l l e d - p > r o g r a > m s . p s 1 " , [ S y s t e m . I O . F i l e m o d e ] : : O p e n , > [ S y s t e m . I O . F i l e A c c e s s ] : : R e a d ) ; [ S y s t e m > . B i t C > o n v e r t e r ] : : T o S t r i n g ( $ s p . C o m p u t e H a s h ( $ > f p ) ) . R e p l a c e ( " - " , " " ) . T o L o w e r ( ) ; $ f p . D > i s p o s > e ( ) ; } E l s e I f ( T e s t - P a t h - P a t h T y p e C o > n t a i n e r " C : \ U s e r s \ j k l e e \ l i s t - i n s t a l l e d > - p r o g > r a m s . p s 1 " ) { W r i t e - H o s t " 3 " ; } E l s e { > W r i t e - H o s t " 1 " ; } > fatal: [w99app02.cloudapp.net] => module copy not found in configured > module paths. Additionally, core modules are missing. If this is a > checkout, run 'git sub > module update --init --recursive' to correct this problem. > <w99app01.cloudapp.net> EXEC ( N e w - I t e m - T y p e D i r e c t > o r y - P a t h $ e n v : t e m p - N a m e " a n s i b l e - t m p > - 1 4 1 8 7 > 4 0 6 3 3 . 7 8 - 5 4 5 3 2 0 4 6 4 0 1 3 1 7 " ) . F u l l N a m e | > W r i t e - H o s t - S e p a r a t o r ' ' ; > <w99app01.cloudapp.net> PUT /home/jklee/poc/list-installed-programs.ps1 > TO > C:\Users\Jklee\AppData\Local\Temp\ansible-tmp-1418740633.78-54532046401317\source > fatal: [w99app01.cloudapp.net] => module copy not found in configured > module paths. Additionally, core modules are missing. If this is a > checkout, run 'git sub > module update --init --recursive' to correct this problem. > > FATAL: all hosts have already failed -- aborting > > PLAY RECAP > ******************************************************************** > to retry, use: --limit @/home/jklee/testcopy.retry > > w99app01.cloudapp.net : ok=0 changed=0 unreachable=1 > failed=0 > w99app02.cloudapp.net : ok=0 changed=0 unreachable=1 > failed=0 > > -- > 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] > <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/d625277b-618b-455f-a747-0bf678877173%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/d625277b-618b-455f-a747-0bf678877173%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v8F-3O%3DfzGRGnAQZOVi_kt_ujq-TFEvLBU5%3DFJy0Lz-Sg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
