You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
936 B
YAML

---
- name: Link data directory to HDD if requested
when:
- use_hdd_directory and hdd_target_dir is defined
block:
- name: Check source directory
stat:
path: "{{ hdd_source_dir }}"
follow: no # to check if it is a link
get_attributes: no
get_checksum: no
get_mime: no
register: source_dir_info
- name: Ensure that source directory is not already used
fail:
msg: >-
Source directory {{ hdd_source_dir | quote }} already used,
please shutdown service and transfer data manually
when:
- source_dir_info.stat.exists and not source_dir_info.stat.islnk
- name: Create target directory on HDD
file:
state: directory
path: "{{ hdd_target_dir }}"
- name: Create link from source to target
file:
state: link
src: "{{ hdd_target_dir }}"
dest: "{{ hdd_source_dir }}"