mirror of
https://github.com/ansible/ansible.git
synced 2026-07-28 08:05:22 +02:00
When the seuser parameter is provided but SELinux is not enabled on the target system, the parameter is silently ignored and the module reports changed: true. This misleads users into thinking SELinux user mappings were applied. Emit a warning when seuser is set and SELinux is not enabled, so users are aware the parameter has no effect. This uses module.selinux_enabled() to check at runtime rather than checking the platform type, as recommended by the maintainers. The warning alone is not enough — useradd still receives the -Z flag and fails with "useradd: -Z requires SELinux enabled kernel". Skip adding -Z to the command when SELinux is not enabled. Fixes #85542 --------- Co-authored-by: olegnazarov23 <olegnazarov23@users.noreply.github.com>