Refactor systemd unit files for mounting and opening LUKS devices

This commit is contained in:
2024-09-29 00:16:51 +02:00
parent abf28888fb
commit 2206c2b67a
2 changed files with 19 additions and 3 deletions
+6 -3
View File
@@ -93,6 +93,7 @@
[Unit]
Description=Open LUKS device
After=network-online.target
Before=snap.microk8s.daemon-kubelite.service
[Service]
Type=oneshot
@@ -103,7 +104,7 @@
ExecStop=/usr/sbin/cryptsetup close {{ luks_device_name }}
[Install]
WantedBy=remote-fs.target
WantedBy=snap.microk8s.daemon-kubelite.service
- name: Create systemd service to mount the file system
ansible.builtin.copy:
@@ -112,7 +113,9 @@
content: |
[Unit]
Description=Mount LUKS device
After=remote-fs.target
After={{ key_fetch_service }}
Requires={{ key_fetch_service }}
Before=snap.microk8s.daemon-kubelite.service
[Mount]
What=/dev/mapper/{{ luks_device_name }}
@@ -121,7 +124,7 @@
Options=defaults
[Install]
WantedBy=multi-user.target
WantedBy=snap.microk8s.daemon-kubelite.service
- name: Reload systemd daemon
ansible.builtin.systemd: