Ansible - Only if a file exists or does not exist - Raymii.org
www.raymii.org › s › tutorialsDec 27, 2014 · It should run only if that file does not exist (because only newly deployed servers will not have the file), if the file exist there is no need to run again. - name: generate dh params command: sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 args: creates: /etc/ssl/certs/dhparam.pem Ansible has the creates option in the command module. Give it a filename (directories will not work) and if it already exists Ansible will skip the action.