-1

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

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

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 .

0

1 Answer 1

3

You need to replace command with shell.

The command module takes the command name followed by a list of space-delimited arguments. The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like $HOME and operations like "<", ">", "|", and "&" will not work (use the shell module if you need these features).

Source: Ansible docs.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.