It's not a bad idea, but it would need a bit of work to cater to
things like directories.
I often use a task like this to create automatically versioned
directory names if I can't
find an RPM:
- name: extract {{ foobar_version }}.tgz
unarchive: src=/tmp/{{ foobar_version }}.tgz
dest=/usr/local
creates=/usr/local/{{ foobar_version }}
On 26 November 2016 at 05:22, Jon Forrest <[email protected]> wrote:
> The Ansible documentation shows the following example for the 'command'
> module"
>
> - command: /usr/bin/make_database.sh arg1 arg2 creates=/path/to/database
>
> The idea here is that if the /path/to/database file already exists,
> the command doesn't run. This is a poor man's way of adding idempotence.
>
> But, what if a previous module, or external command, created a new
> version of /path/to/database that requires the command to be run again?
> The mere fact that /path/to/database exists isn't sufficient to
> determine with the command should be run again. Instead, it's the
> combination of whether the file exists, and its contents.
>
> What if there were an addition argument called "with_sha1hash" that
> contains a hash value to use to recognize whether /path/to/database has
> changed. For example,
>
> - command: /usr/bin/make_database.sh arg1 arg2 creates=/path/to/database
> with_sha1hash="ab34ac"
>
> (The hash value can be enough of the first characters of the hash to
> be unique, the way Git does things).
>
> If /path/to/database exists, but it doesn't have "ab34ac" as
> its sha1 hash, the command would be run.
>
> This would be an optional argument so it wouldn't affect
> any existing playbooks.
>
> I have to admit I don't have any examples of when this would be
> necessary but it seems like such a thing could exist. Does this
> make sense?
>
> Jon Forrest
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/o1b65m%244ut%241%40blaine.gmane.org.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAK5eLPRWoC68BvnQtSZmsKP_LinKUrGxqFWpjEMO6vVvnZ0ksg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.