command/shell execution now idempotent

The following now works in the latest git:

  • name: run this command if this file doesn’t already exist
    action: shell /srv/dbsetup.sh foo bar baz creates=/srv/path/to/database

Explanation: If creates=path is found on the arguments line to the shell command, the command will only be run if the specified file does not already exist. This concept is borrowed more or less exactly from Puppet. The syntax is a tiny bit weird because the shell/command module is the only module that does not take keyword arguments. The “create=foo” line will not be passed to the command being executed.

Related: From the discussion about “no remote logging” yesterday, it almost seems as if the command module is the only one we wouldn’t want to log. In which case, might the no logging use case be handled in exactly the same way?

–Michael