command module

50 views
Skip to first unread message

Shreya Bhardwaj

unread,
Nov 5, 2020, 1:50:07 AM11/5/20
to Ansible Project
Hello Everyone,

I'm using the command module to run a few commands.
I'm using the "creates" feature of the module as a check so that re running of command can be prevented, but it isn't creating the file in the first place.

what could be the possible reason of it? 

Thanks

Stefan Hornburg (Racke)

unread,
Nov 5, 2020, 1:59:07 AM11/5/20
to ansible...@googlegroups.com
The module doesn't create the file. The idea is that the command itself creates that file.

Regards
Racke

>
> Thanks
>
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/60336921-b23b-4b1f-9187-5ddf7dfdf648n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/60336921-b23b-4b1f-9187-5ddf7dfdf648n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.
OpenPGP_0x5B93015BFA2720F8.asc
OpenPGP_signature

Shreya Bhardwaj

unread,
Nov 9, 2020, 6:30:12 AM11/9/20
to Ansible Project
Yes, realized that later.

Thanks

Message has been deleted

Rowe, Walter P. (Fed)

unread,
Nov 8, 2022, 8:32:15 AM11/8/22
to ansible...@googlegroups.com
Yes! This is only used to avoid running the command if the file exists. The command you run must create the file if you intend to use the existence of the file to prevent running the command again.


The documentation for the creates parameter does not state that it creates the file for you.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Nov 8, 2022, at 8:21 AM, Nobody Cares <new...@live.de> wrote:

and how should that work if command does not create any file?! should i create a custom script, run that by ansible?
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d7879524-4af6-4f7a-a216-8f12e3112bb0n%40googlegroups.com.

Nobody Cares

unread,
Nov 8, 2022, 8:47:07 AM11/8/22
to Ansible Project

i did not say that file will be created... i did ask how to do that with command not creating files....

okay,
creating task to creating custom script (with: touch file.txt)
create new task running that script
creating task removing scipt

looks easy
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.

Brian Coca

unread,
Nov 8, 2022, 1:41:49 PM11/8/22
to Ansible Project
creating task to creating custom script (with: touch file.txt)
not really needed, can just use the 'shell'  action and && , but you can if you really want to .. you can write the script.

create new task running that script
creating task removing scipt
 
also not needed, the 'script' action will automatically copy + execute + remove the script from remote

Reply all
Reply to author
Forward
0 new messages