Hi,

I want to execute a command if a file exist.

The script juste create a file in the same folder.
 #/bin/sh


 touch test.txt



Ansible execute module below.
 ---
 # Vérification
 - name: Vérification si le script existe
   stat:
 path: "/tmp/test.sh"
   register: file_exist


 # Exécution
 - name: Exécution du script si il existe
   shell: "/tmp/test.sh"
   when: file_exist.stat.exists

...

This is the result on screen
 TASK [LINUX_test : Vérification si le script existe] 
*********************************************************************************************
 ok: [test1]


 TASK [LINUX_test : Exécution du script si il existe] 
*********************************************************************************************
 changed: [test1]



But the script doesn't create the file in the same folder.

Do you have an idea?

Thanks for your help,

Matt

-- 
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/3ea9d633-93e6-40af-be6f-59a8516c9d85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to