Make modprobe module check for builtins as well (#37150)

Without this modprobe always reports changed when modprobe-ing a builtin module.

With this, if a kernel module is a builtin, the modprobe module will:
- succeed (without incorrectly reporting changed) if ``state`` is ``present``;
- fail if ``state`` is ``absent``

The failure will have whatever error message modprobe returns when
attempting to remove a builtin module. For example:
``modprobe: ERROR: Module nfs is builtin.``
This commit is contained in:
Jacob Floyd 2018-12-20 15:30:29 -06:00 committed by Alicia Cozine
commit 069e0b8d57
3 changed files with 25 additions and 7 deletions

View file

@ -131,6 +131,13 @@ Noteworthy module changes
* The ``na_ontap_cluster_peer`` module has replaced ``source_intercluster_lif`` and ``dest_intercluster_lif`` string options with
``source_intercluster_lifs`` and ``dest_intercluster_lifs`` list options
* The ``modprobe`` module now detects kernel builtins. Previously, attempting to remove (with ``state: absent``)
a builtin kernel module succeeded without any error message because ``modprobe`` did not detect the module as
``present``. Now, ``modprobe`` will fail if a kernel module is builtin and ``state: absent`` (with an error message
from the modprobe binary like ``modprobe: ERROR: Module nfs is builtin.``), and it will succeed without reporting
changed if ``state: present``. Any playbooks that are using ``changed_when: no`` to mask this quirk can safely
remove that workaround. To get the previous behavior when applying ``state: absent`` to a builtin kernel module,
use ``failed_when: false`` or ``ignore_errors: true`` in your playbook.
Plugins
=======