I dont want to create a script placing files or removing files.... just to run one command...
any ideas?
I dont want to create a script placing files or removing files.... just to run one command...
any ideas?
The ansible file module?
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html
try this to explain new employees you need to place a file there, otherwise the command will be execute again :DDDDD
for me this is a bug
but ok i will do it with extra steps.... if everyone else is happy with that solution, i'm fine with that
Easy peasy. This was recommended before, although no one explicitly wrote it out.
Otherwise, do a task before, to actually evaluate whether you need to run the command in the first place, instead of relying on the existence of a file.
Tracking files that are not the normal side effect of a command are a
poor way to track if a command was executed, the best way is to track
the expected side effect of such a command (creates/removes does this
by assuming those files are created/removed by the command's
execution). There are other side effects that you can track, but hard
to build them all into the command/shell modules (open port/service
running/package installed/etc) but there are plenty of other actions
that can query this.
Also, if the built in command does not do exactly what you want, you
are free to create your own custom version, it just not make sense for
this in the core offering.
- shell:
cmd: do_something && touch /etc/do_something/done
creates: /etc/do_something_done
This is the best solution. But why does i need to ask the Mailing list do get this? why ansible cant do this by itself? or why is this solution not in documentation?
Otherwise, do a task before, to actually evaluate whether you need to run
the command in the first place, instead of relying on the existence of a
file.
for me its funny how complicated it is to just run a command... (known workarounds are not easy to access...)
But OK, everybody + developer are fine with that bug