Skip to content

Conversation

@Spectro34
Copy link

@Spectro34 Spectro34 commented Dec 7, 2025

Enhancement: Add SLE16+ support to kdump role

Reason: SLES systems require different tools for crashkernel configuration. The role currently only supports RedHat family systems using grubby, which is not available on SLES. SLES 16+ uses kdumptool commandline -u to update bootloader crashkernel settings.

Result:

  • Added SLES-specific variables in vars/Suse.yml for packages, config file, and service name
  • Added kdumptool commandline -u task for SLES 16+ crashkernel updates
  • Role now properly configures kdump on SLES 16+ systems

Issue Tracker Tickets (Jira or BZ if any): NA

Summary by Sourcery

Add SLES 16+ and openSUSE support to the kdump role and tighten kdump service management around reboot requirements.

New Features:

  • Introduce Suse-specific defaults for kdump packages, configuration file path, and service name to support SLES and openSUSE systems.
  • Add a SLES 16+/openSUSE crashkernel update step using kdumptool commandline -u when a reboot is required.

Enhancements:

  • Ensure the kdump service is only started when no reboot is required after configuration changes.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 7, 2025

Reviewer's Guide

Adds SLE16+ (and openSUSE 16+) support to the kdump Ansible role by introducing SUSE-specific variables and using kdumptool instead of grubby for crashkernel updates, while skipping kdump service start when a reboot is required.

Sequence diagram for SLES16+ crashkernel update using kdumptool

sequenceDiagram
    actor Admin
    participant AnsibleController
    participant KdumpRole
    participant SLES16Host
    participant Kdumptool

    Admin->>AnsibleController: run kdump role on SLES16Host
    AnsibleController->>KdumpRole: execute tasks/main.yml
    KdumpRole->>SLES16Host: gather ansible_facts
    KdumpRole->>SLES16Host: evaluate kdump_reboot_required

    alt os_family is Suse and distribution_major_version >= 16 and kdump_reboot_required is true
        KdumpRole->>Kdumptool: /usr/sbin/kdumptool commandline -u
        Kdumptool-->>KdumpRole: update bootloader crashkernel setting
    else other systems or versions
        KdumpRole-->>SLES16Host: skip kdumptool task
    end

    alt kdump_reboot_required is false
        KdumpRole->>SLES16Host: start __kdump_service
        SLES16Host-->>KdumpRole: kdump service started
    else kdump_reboot_required is true
        KdumpRole-->>SLES16Host: skip __kdump_service start
    end

    KdumpRole-->>AnsibleController: role execution complete
    AnsibleController-->>Admin: report kdump configuration status
Loading

Flow diagram for kdump role logic with Suse-specific handling

flowchart TD
    A["Start kdump role"] --> B["Gather ansible_facts"]
    B --> C{os_family == 'Suse'?}

    C -- Yes --> D{distribution_major_version >= 16?}
    C -- No --> H["Use non-Suse crashkernel update path"]

    D -- Yes --> E{kdump_reboot_required?}
    D -- No --> H

    E -- true --> F["Run /usr/sbin/kdumptool commandline -u"]
    E -- false --> G["Skip kdumptool crashkernel update"]

    F --> I["Evaluate kdump_reboot_required for service start"]
    G --> I
    H --> I

    I --> J{kdump_reboot_required is false?}

    J -- Yes --> K["Start __kdump_service (e.g. kdump)"]
    J -- No --> L["Skip __kdump_service start (reboot required)"]

    K --> M["End kdump role"]
    L --> M
Loading

Flow diagram for Suse-specific kdump variables in vars/Suse.yml

flowchart LR
    A["Host with os_family == 'Suse'"] --> B["Ansible loads vars/Suse.yml"]
    B --> C["Set __kdump_packages = [iproute, kexec-tools, kdump, openssh-clients]"]
    C --> D["Set __kdump_conf_file = /etc/kdump.conf"]
    D --> E["Set __kdump_service = kdump"]
    E --> F["Tasks use Suse-specific variables for installation and service management"]
Loading

File-Level Changes

Change Details Files
Add SLES/SUSE-specific kdump variables so the role can manage packages, config, and service on Suse systems.
  • Define Suse-specific kdump package list including kexec-tools, kdump, iproute, and openssh-clients.
  • Set Suse-specific kdump configuration file path variable.
  • Set Suse-specific kdump service name variable.
vars/Suse.yml
Implement crashkernel update handling for Suse using kdumptool and adjust service start behavior when reboot is required.
  • Add a Suse-only task block that runs kdumptool commandline -u on SLES/openSUSE 16+ when a reboot is required.
  • Ensure crashkernel update task is marked changed when executed.
  • Restrict kdump service start to only run when a reboot is not required.
tasks/main.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The Suse-specific crashkernel update block currently only checks os_family == 'Suse' and version >= 16; consider also restricting by distribution (e.g. SLES vs openSUSE variants) so this doesn’t attempt to run kdumptool on Suse-family systems that may not provide it.
  • The kdumptool commandline -u task is forced to changed_when: true, which will always report a change; if possible, make this idempotent (e.g. by inspecting the current crashkernel configuration or using command output/return codes) to avoid unnecessary handler runs and confusing change reports.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Suse-specific crashkernel update block currently only checks `os_family == 'Suse'` and version >= 16; consider also restricting by `distribution` (e.g. SLES vs openSUSE variants) so this doesn’t attempt to run `kdumptool` on Suse-family systems that may not provide it.
- The `kdumptool commandline -u` task is forced to `changed_when: true`, which will always report a change; if possible, make this idempotent (e.g. by inspecting the current crashkernel configuration or using command output/return codes) to avoid unnecessary handler runs and confusing change reports.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

tasks/main.yml Outdated
- ansible_facts['os_family'] == 'Suse'
block:
- name: Use kdumptool commandline -u (SLES 16+/openSUSE)
command: /usr/sbin/kdumptool commandline -u
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What package provides kdumptool?

tasks/main.yml Outdated
when:
- kdump_reboot_required | bool
- ansible_facts['os_family'] == 'Suse'
block:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is not needed - you could just have the single task name: Use kdumptool commandline -u (SLES 16+/openSUSE) without the block and add the when conditions above to that task

@Spectro34
Copy link
Author

Looks like sle is not using /etc/kdump.conf and puts everything kernel parameters and service config in /etc/sysconfig/kdump, working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants