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.
[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] *************************************************************
<
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