command/shell tasks Results in Failures with the Use of action

‘shell:’ and ‘action: shell’ should be interchangable, this seems like a bug.

I’ve been able to reproduce, seems like a quoting issue.

using shell:

  • name: Touch Foobar
    shell: “touch /tmp/foobar”

changed: [127.0.0.1] => {“changed”: true, “cmd”: "touch /tmp/foobar ", “delta”: “0:00:00.022968”, “end”: “2013-05-22 22:05:50.451941”, “rc”: 0, “start”: “2013-05-22 22:05:50.428973”, “stderr”: “”, “stdout”: “”}

using action: shell

  • name: Touch Foobar
    action: shell “touch /tmp/foobar”

failed: [127.0.0.1] => {“changed”: true, “cmd”: ""touch /tmp/foobar" ", “delta”: “0:00:00.008091”, “end”: “2013-05-22 22:05:51.235269”, “rc”: 127, “start”: “2013-05-22 22:05:51.227178”}

stderr: /bin/sh: touch /tmp/foobar: No such file or directory

using action: shell and no quotes:

  • name: Touch Foobar
    action: shell touch /tmp/foobar

changed: [127.0.0.1] => {“changed”: true, “cmd”: "touch /tmp/foobar ", “delta”: “0:00:00.009709”, “end”: “2013-05-22 22:08:05.562070”, “rc”: 0, “start”: “2013-05-22 22:08:05.552361”, “stderr”: “”, “stdout”: “”}

While I agree it would be nice if these unnecessary quotes are stripped automatically by the system, this it he first I’ve seen it come up, so I’m not extremely worried by it.

It’s definitely not anything new.

Basically if something takes multiple arguments, and you quote them, it makes those things “one argument”.

That is a little bit different than quoting the whole options line, which is just telling YAML “hey this is all one string”, which is generally implicit unless you have a colon in there.