I’m currently facing a problem that seems simple but it’s not. Here goes.
I rent a series of servers at Scaleway.com. In the default configuration SELinux is deactivated. So the first thing I do after installing Rocky Linux 8 is enable SELinux in enforcing mode:
This action would require no less than two actions:
Create an empty /.autorelabel file (so the whole filesystem gets relabeled after the next reboot).
Reboot.
Now how would I translate this in Ansible syntax? Here’s what I imagine:
notify: Relabel
notify: Reboot
But as far as I know, multiple handlers are not possible. And I’d also have to make sure that the Relabel handler is actually executed before the Reboot handler, which is not sure.
IIRC, I did try (and fail) two notify lines myself too.
Alternative is to register on the selinux task and conditionally touch the file, if selinux task did change system.
Handlers are nice when multiple tasks may require action X, but you need to do X only once, after all those tasks. I presume that you don’t need to touch /.autorelabel for any other reason than that one task?