2025-12-23 19:56:26 +08:00

38 lines
888 B
YAML

---
- name: Ensure source and destination directories exist
file:
path: "{{ item }}"
state: directory
mode: '0755'
owner: jingrow
group: jingrow
loop:
- /home/jingrow/archived
- /opt/volumes/benches/archived
- name: Move existing files from old archive to new location
command: mv /home/jingrow/archived/* /opt/volumes/benches/archived/
args:
removes: /home/jingrow/archived/*
ignore_errors: yes
- name: Set ownership recursively
file:
path: "{{ item }}"
owner: jingrow
group: jingrow
recurse: true
loop:
- /opt/volumes/benches/archived
- /home/jingrow/archived
- name: Add bind mount to /etc/fstab
lineinfile:
path: /etc/fstab
line: "/opt/volumes/benches/archived /home/jingrow/archived none defaults,nofail,bind 0 0"
state: present
create: yes
- name: Mount all from fstab
command: mount -av