You are on page 1of 1

---

- hosts: host01

tasks:
- stat: path=/home/ubuntu/folder1/somefile.j2
register: st
- template: src=somefile.j2 dest=/home/ubuntu/folder1/somefile.j2
when: not st.stat.exists

ansible-playbook -i myhosts test.yml

You might also like