20 lines
524 B
YAML
20 lines
524 B
YAML
---
|
|
# NOTE: This is just an internal task that checks if a file exists
|
|
# before copying, to prevent changes from being overwritten.
|
|
#
|
|
- name: "Check if {{ destination | basename }} exists already."
|
|
ansible.builtin.stat:
|
|
path: "{{ destination }}"
|
|
register: filestat
|
|
tags:
|
|
- always
|
|
|
|
- name: "Copy {{ destination | basename }} file."
|
|
ansible.builtin.copy:
|
|
src: "{{ source }}"
|
|
dest: "{{ destination }}"
|
|
mode: "{{ mode | default('0600') }}"
|
|
when: not filestat.stat.exists
|
|
tags:
|
|
- always
|