ansible doesn't support commands containing special letters

such as “ls && cd …” and " if [ ! -d “/myfolder” ]". so some command can be run at the terminal but not in ansible, sometimes we have to write a script file to enable the command.
Personally thinking, I think this feature could be improved.

Have you tried the shell module instead of the command module?

Command module does not support pipes, use shell module

Brian Coca

Thank you. Even I use shell in my cookbook, I only try to change the line with command.

dI should be more careful.