guidugli.grub

Ansible Role: grub

This Ansible Role sets up grub on RHEL/CentOS, Fedora, and Debian/Ubuntu systems.

Requirements

You need a physical server or a virtual machine to run this. Grub won't work in container environments.

Role Variables

Here are the available variables with their default values (check defaults/main.yml):

  • grub_cmdline_var_name: GRUB_CMDLINE_LINUX
    Choose which variable to edit. Options are:

    • GRUB_CMDLINE_LINUX
    • GRUB_CMDLINE_LINUX_DEFAULT
  • grub_default_path: /etc/default/grub
    This is the full path to the default grub settings.

  • grub_timeout: 5
    This sets the grub menu timeout in seconds.

  • grub_recordfail_timeout: "{{ grub_timeout }}"
    This sets the menu timeout if the "recordfail" condition is true.

  • grub_allow_reboot: no
    Should the role reboot the system after configuring grub?

  • grub_options_present:
    Add options to GRUB_CMDLINE_LINUX. This value is optional.
    Example:

    - cgroup_enable=memory
    - quiet
    - some.option=complex,off
    
  • grub_options_absent:
    Remove options from GRUB_CMDLINE_LINUX. Just list the keys you want to remove.
    Example: To remove audit=0, simply add audit to this list.
    If an option to be added is listed here, it won't be removed.

  • grub_superuser: myuser

  • grub_password: grub.pbkdf2.sha512.10000....
    Set the grub username and password.

  • grub_boot_path: /boot/grub2 (optional)
    The role checks for /boot/grub or /boot/grub2 if this variable isn't defined.

  • grub_cfg_path: /boot/grub2/grub.cfg (optional)
    The role checks for this file at grub_boot_path or /boot/efi/EFI... if EFI is enabled, only if this variable is not defined.

The following variables are automatically set and usually don't need to be changed (see vars/main.yml):

  • grub_packages:
    Packages needed for grub functionality.

  • grub_update_grub_command:
    Command to update grub.

  • grub_cmdline_var_name:
    The variable to change to add or remove kernel options.

  • grub_d_path:
    The grub configuration directory.

Dependencies

There are no dependencies.

Example Playbook

- hosts: servers
  vars:
    grub_timeout: 5
    grub_recordfail_timeout: "{{ grub_timeout }}"
    grub_options_present:
      - cgroup_enable=memory
      - quiet
      - some.option=complex,off
    grub_options_absent:
      - splash
      - rd.driver.pre
    grub_superuser: testuser
    grub_password: grub.pbkdf2.sha512.10000....
  roles:
     - { guidugli.grub }

License

MIT / BSD

Author Information

This role was created by Carlos Guidugli in 2020.

Informazioni sul progetto

Install and configure GRUB on linux

Installa
ansible-galaxy install guidugli.grub
Licenza
mit
Download
123
Proprietario