Hi,
I want to execute a command if a file exist.
The script juste create a file in the same folder.
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