Added role misc/overlay_mount

dehydrated
Felix Stupp 4 years ago
parent bd4d97d835
commit 9c1e1e6ecd
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -31,6 +31,7 @@ Following roles have been defined for making a server configuration easy:
- **docker** installs *Docker* (from official Docker repository)
- **handlers** contains some handlers used by other roles
- **ip_discover** configures a server to automatically discover its ip addresses to a supported service
- **overlay_mount** configures an overlay mount with systemd
- **system_user** creates a system user
- **mysql** defines roles for handling mysql databases and users, uses *MariaDB*
- **application** installs the main application with automatic backup

@ -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…
Cancel
Save