Skip to content

Role ignores check mode / files changed in check mode #190

@divialth

Description

@divialth

The role in the version 1.1.6 changes the configuration, even if it is only running in check mode.
(ansible collection "fedora.linux_system_roles" 1.120.2)

Test

Config

bootloader_settings:
  - kernel: ALL
    options:
      - name: console
        value: ttyS0
        state: present
cp /etc/default/grub /tmp
ansible-playbook -u xxx -i inventories/systems  playbook.yml --diff -C

Output:

...
TASK [fedora.linux_system_roles.bootloader : Ensure boot loader settings] **********************************************************************************************************************************************************************************************************
changed: [xxxxxxxx]
...

So far so good, but if we now look at the file, we see it was really changed on disk, even the role was run in check mode:

Diff:

# diff -u /tmp/grub /etc/default/grub
--- /tmp/grub	2026-02-16 16:23:12.195305407 +0100
+++ /etc/default/grub	2026-02-16 16:23:49.374560550 +0100
@@ -3,6 +3,6 @@
 GRUB_DEFAULT=saved
 GRUB_DISABLE_SUBMENU=true
 GRUB_TERMINAL_OUTPUT="console"
-GRUB_CMDLINE_LINUX="ro resume=/dev/mapper/system-swap rd.lvm.lv=system/root rd.lvm.lv=system/swap rhgb quiet console=tty0 "
+GRUB_CMDLINE_LINUX="ro resume=/dev/mapper/system-swap rd.lvm.lv=system/root rd.lvm.lv=system/swap rhgb quiet console=ttyS0"
 GRUB_DISABLE_RECOVERY="true"
 GRUB_ENABLE_BLSCFG=true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions