ansible : how to pass multiple commands?


I tried this:

which works, but I was hoping for something neater.

So I tried this which give me back “no such file or directory”

I tried below too:

but I couldn’t find the right syntax to put:

That does not work, saying there is a quote issue.


If a value in YAML begins with a curly brace ({), the YAML parser assumes that it is a dictionary. So, for cases like this where there is a (Jinja2) variable in the value, one of the following two strategies needs to be adopted to avoiding confusing the YAML parser:

Quote the whole command:

or change the order of the arguments:

Leave a Reply