# To check whether specific file is present or not on managed host and if not then create it. --- - name: Demo of file creation if not already present hosts: nodes tasks: - name: Real work stat: path: /tmp/Thrusday register: info - name: Printing debug: var: info.stat.exists - name: Creating one copy: content='Today is guruwar no-worry practice more gonna score more in rhce then rhcsa' dest='/tmp/Thrusday' when: info.stat.exists != "false" ...