Como verificar se existe um arquivo no ansible?
Eu tenho que verificar se existe um arquivo no/etc/
. Se o arquivo existir, tenho que pular a tarefa. Aqui está o código que estou usando:
- name: checking the file exists
command: touch file.txt
when: $(! -s /etc/file.txt)
Se ofile.txt
existe, então eu tenho que pular a tarefa.