feat: Initial commit
This commit is contained in:
17
roles/create_if_not_exists/tasks/main.yml
Normal file
17
roles/create_if_not_exists/tasks/main.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
# Check if a file exists at the destination already, copy it if not.
|
||||
- name: "Check if {{ destination | basename }} exists."
|
||||
ansible.builtin.stat:
|
||||
path: "{{ destination }}"
|
||||
register: filestat
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: "Copy {{ source }} file to {{ destination }}."
|
||||
ansible.builtin.copy:
|
||||
src: "{{ source }}"
|
||||
dest: "{{ destination }}"
|
||||
mode: "{{ mode | default('0600') }}"
|
||||
when: not filestat.stat.exists
|
||||
tags:
|
||||
- always
|
||||
Reference in New Issue
Block a user