haw to save the output of a script in a file ansible 2.0.2



down votefavorite


|


i want to save the output of a command in a file , i tried to use :



<br>- command: ./script1 >> file.txt 2>&1 <br>



but it’s give me an empty file. Is there any other method to save the output of my “script1” in a “file” using ansible 2.0.2 . thank you in advance .


|

Hi,

You probably need to use the shell module instead of the command module - command runs commands without a shell. To use >> and 2>&1, which are thing that your shell gives you, you need to use the shell module.

Hope this helps,

Jon

thank you Jon , it’s really helpful