linux-system-roles.bootloader

Bootloader

Ansible Lint Ansible Test CodeQL Markdown Lint Python Unit Test Terraform Test Terraform Test Bad Woke

This is an Ansible role for managing the bootloader and the kernel command line.

Supported Architectures

This role currently supports configuring the grub2 bootloader on the following architectures:

  • AMD and Intel 64-bit (x86-64)
  • 64-bit ARM (ARMv8.0)
  • IBM Power Systems, Little Endian (POWER9)

Requirements

Collection Requirements

  • If you don’t need to manage ostree systems, this role doesn’t have any requirements.
  • If you want to manage ostree systems, you'll need additional modules from external collections. Install them using:
ansible-galaxy collection install -vv -r meta/collection-requirements.yml

Role Variables

bootloader_gather_facts

Controls whether to gather bootloader facts, which include boot information for all kernels.

Default: false

Type: bool

bootloader_settings

Use this variable to list kernels and their command line parameters that you want to set.

Required keys:

  1. kernel - Specify the kernel for which you want to update settings. Each list should reference the same kernel.

    • To add a kernel, specify three keys: path, title, initrd.
    • To change or remove a kernel, specify one or more keys.
    • Use DEFAULT or ALL to update the default kernel or all kernels.

    Available keys:

    • path - the kernel's path
    • index - the kernel's index
    • title - the kernel's title
    • initrd - the kernel's initrd image

    Available options:

    • DEFAULT - to update the default entry
    • ALL - to update all entries
  2. state - The state of the kernel.

    • Options: present, absent
    • Default: present
  3. options - Settings you wish to update.

    • name - The setting's name. Omit when using replaced.
    • value - The setting's value. Omit if it doesn't have a value, e.g., quiet.
    • state - Either present (default) or absent. Use absent to remove a setting.
    • previous - Optional. Use replaced to indicate previous settings should be replaced.
    • copy_default - Optional. Set copy_default: true to copy the default arguments when creating a kernel.

Check the Example Playbook for more details.

Default: {}

Type: dict

bootloader_timeout

Customize the GRUB bootloader's loading time.

Default: 5

Type: int

bootloader_password

Protect boot parameters with a password.

WARNING: Changing the bootloader password is not idempotent.

The username for the boot loader is always root.

It's recommended to store this in a vault.

If not set, the current configuration remains unchanged.

Default: null

Type: string

bootloader_remove_password

Set this variable to true to remove the bootloader password.

Default: false

Type: bool

bootloader_reboot_ok

If true, the role will reboot the managed host if a change requires it.

If false, you decide when to reboot.

The role returns a variable bootloader_reboot_required to indicate whether a reboot is needed.

Default: false

Type: bool

Variables Exported by the Role

The role exports the following variables:

bootloader_reboot_needed

Default false - If true, a reboot is needed to apply changes made by the role.

bootloader_facts

Contains boot information for all kernels.

This variable is returned when you set bootloader_gather_facts: true.

Example:

"bootloader_facts": [
    {
        "args": "ro rootflags=subvol=root ...",
        "id": "...",
        "index": "3",
        "initrd": "/boot/initramfs-0-rescue-...",
        "kernel": "/boot/vmlinuz-0-rescue-...",
        "root": "UUID=...",
        "title": "Fedora Linux...",
        "default": True
    },
    ...
]

Example Playbook

- hosts: all
  vars:
    bootloader_settings:
      # Update existing kernel based on path
      - kernel:
          path: /boot/vmlinuz-6.5.7-100.fc37.x86_64
        options:
          - name: console
            value: tty0
            state: present
          - previous: replaced
      # Update existing kernel using index
      - kernel:
          index: 1
        options:
          - name: print-fatal-signals
            value: 1
      # Add a kernel with arguments
      - kernel:
          path: /boot/vmlinuz-6.5.7-100.fc37.x86_64
          initrd: /boot/initramfs-6.5.7-100.fc37.x86_64.img
          title: My kernel
        options:
          - name: console
            value: tty0
          - name: print-fatal-signals
            value: 1
          - name: no_timer_check
            state: present
        state: present
    bootloader_timeout: 5
    bootloader_password: null
    bootloader_remove_password: false
    bootloader_reboot_ok: true
  roles:
    - linux-system-roles.bootloader

rpm-ostree

See README-ostree.md for more information.

License

MIT

Informazioni sul progetto

Ansible role for bootloader management

Installa
ansible-galaxy install linux-system-roles.bootloader
Licenza
mit
Download
82.9k
Proprietario