I'm setting up a dm-integrity block device to be mounted at boot. For this I used systemd's /etc/integritytab mechanism. My Linux kernel does not have the dm_integrity kernel module built-in. Hence, I have to load it before systemd-integritysetup is executed.
I'm trying to create a setup without creating any new units to keep the maintenance effort low. I planned to use the integritysetup-pre.target provided by systemd but could not figure out how.
I can add a modprobe@dm_integrity.service with a wants dependency which loads the module at startup.
systemd add-wants integritysetup.target modprobe@dm_integrity.service
However, I think I understand this this does not guarantee the order I should end up with.
modprobe@dm_integrity.service -> integritysetup-pre.target -> systemd-integritysetup@dev.service -> integritysetup.target