Added role misc/overlay_mount
parent
bd4d97d835
commit
9c1e1e6ecd
@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
# target_directory
|
||||
|
||||
# upper_directory
|
||||
# work_directory
|
||||
# lower_directories
|
||||
|
||||
unit_name: "{{ target_directory | systemd_escape_mount }}"
|
||||
unit_description: "Overlay Mount for {{ taget_directory }}"
|
@ -0,0 +1,32 @@
|
||||
---
|
||||
|
||||
- name: Ensure directories for overlay mount exists
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ item }}"
|
||||
# Do not setup directory, only create if required
|
||||
loop: "{{ [upper_directory, work_directory] + lower_directories }}"
|
||||
|
||||
- name: Create target directory of overlay mount
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ target_directory }}"
|
||||
owner: "{{ target_owner }}"
|
||||
group: "{{ target_group }}"
|
||||
mode: "{{ target_mode }}"
|
||||
|
||||
- name: Configure unit for overlay mount
|
||||
template:
|
||||
src: overlay.mount
|
||||
dest: "{{ global_systemd_configuration_directory }}/{{ unit_name }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
register: overlay_mount_unit_result
|
||||
|
||||
- name: Enable und restart unit for overlay mount
|
||||
systemd:
|
||||
state: restarted
|
||||
name: "{{ unit_name }}"
|
||||
enabled: yes
|
||||
when: overlay_mount_unit_result.changed
|
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description={{ unit_description }}
|
||||
|
||||
[Mount]
|
||||
What=overlay
|
||||
Where={{ target_directory }}
|
||||
Type=overlay
|
||||
Options=upperdir={{ upper_directory }},workdir={{ work_directory }},lowerdir={{ lower_directories | join(':') }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue