Chapter 20. Configuring automatic crash dumps by using the kdump RHEL System Role

To manage kdump using Ansible, you can use the kdump role, which is one of the RHEL System Roles available in RHEL 9.

Using the kdump role enables you to specify where to save the contents of the system’s memory for later analysis.

20.1. Variables of the kdump System Role

Use the mentioned role variables to set kernel dump parameters on multiple systems for RHEL System Roles.

Role VariableDescription

kdump_target

An option to specify the target location to save the crash dump file (vmcore) to a location that is not in the root file system. If the type is raw or a filesystem, the target location points to a partition, such as device node name,label, or uuid.

kdump_path

The path to which vmcore is written. If kdump_target is not null, the path is relative to that dump target. Otherwise, it must be an absolute path in the root file system.

kdump_core_collector

A command to copy the crash dump (vmcore) file. If null, kdump uses the makedumpfile program with options that depend on the kdump_target.type.

kdump_system_action

An alternative operation to perform when kdump fails to save the core dump file (vmcore) to the primary target. The additional operations include reboot, halt, poweroff, and shell.

kdump_auto_reset_crashkernel

An option to reset the crashkernel value to a new default value. For example, reset crashkernel when kexec-tools updates the default crashkernel value to a new value or if existing kernels have the old default kernel crashkernel value.

kdump_dracut_args

An option to pass additional dracut options when rebuilding kdump initrd.

kdump_reboot_ok

An option to configure a reboot action if you run the role on a managed node that does not have sufficient memory reserved for the crash kernel, for example when the file /sys/kernel/kexec_crash_size contains 0 as the crash size, you might need to reboot the managed node to configure kdump again.

Additional resources

  • /usr/share/ansible/roles/rhel-system-roles.kdump/README.md file
  • /usr/share/doc/rhel-system-roles/kdump/ directory
  • makedumpfile(8) man page

20.2. Configuring kdump by using RHEL System Roles

You can set basic kernel dump parameters on multiple systems by using the kdump System Role by running an Ansible playbook.

Warning

The kdump Systeme Role replaces the kdump configuration of the managed hosts entirely by replacing the /etc/kdump.conf file. Additionally, if the kdump role is applied, all previous kdump settings are also replaced, even if they are not specified by the role variables, by replacing the /etc/sysconfig/kdump file.

Prerequisites

Procedure

  1. Create a playbook file, for example ~/playbook.yml, with the following content:

    ---
    - hosts: managed-node-01.example.com
      roles:
        - rhel-system-roles.kdump
      vars:
        kdump_path: /var/crash
  2. Validate the playbook syntax:

    $ ansible-playbook --syntax-check ~/playbook.yml

    Note that this command only validates the syntax and does not protect against a wrong but valid configuration.

  3. Run the playbook:

    $ ansible-playbook ~/playbook.yml

Additional resources

  • /usr/share/ansible/roles/rhel-system-roles.kdump/README.md file
  • /usr/share/doc/rhel-system-roles/kdump/ directory