To conditional or to skip, that's the Ansible question
To Conditional method
- name: Check if file exists
stat:
path: "/tmp/custom_file.json"
register: check_custom_file_exist
- name: Copy custom policy when exist
template:
src: "/tmp/custom_file.json"
dest: "/tmp/destination_file.json"
when: "{{ check_custom_file_exist.stat.exists }}"To Skip method
Analysis and own opinion
Last updated