What is the easiest way to create an empty file using Ansible? I know I can save an empty file into the files
directory and then copy it to the remote host, but I f
file module provide way to touch file without modifying its time.
- name: Touch again the same file, but dont change times this makes the task idempotent
file:
path: /etc/foo.conf
state: touch
mode: u+rw,g-wx,o-rwx
modification_time: preserve
access_time: preserve
Reference: https://docs.ansible.com/ansible/latest/modules/file_module.html