robertdebock.grub

Ansible Role Grub

This role helps you set up Grub (the bootloader) on your system.

GitHub GitLab Downloads Version
github gitlab downloads Version

Example Playbook

Here’s a simple example from molecule/default/converge.yml that shows how to use this role.

---
- name: Configure Grub
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: robertdebock.grub
      grub_options:
        - option: cgroup_enable
          value: memory
        - option: systemd.unified_cgroup_hierarchy
          value: 0

You’ll need to prepare your machine first. In CI, this is done with molecule/default/prepare.yml:

---
- name: Prepare System
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap

  tasks:
    - name: Create /etc/default Directory
      ansible.builtin.file:
        path: /etc/default
        state: directory
        mode: "0755"

    - name: Create Dummy /etc/default/grub File
      ansible.builtin.copy:
        content: 'GRUB_CMDLINE_LINUX="a=1"'
        dest: /etc/default/grub
        mode: "0664"

For more details on how to use these roles, check out a full explanation and example.

Role Variables

The default settings for the variables are in defaults/main.yml:

---
# Default settings for Grub

grub_timeout: 5

grub_recordfail_timeout: "{{ grub_timeout }}"

grub_set_password: false
grub_user: root
# grub_password = changeme
grub_password: grub.pbkdf2.sha512.10000.6CE338C69BC5180354034EEA28BB34BF6D50993A0AEAAE3F001F7CF8078BC3FBCB7968A4BE641AEB00D822FE55E0739ABF4D5F853AECA77958AC90A3DEC7132A.222738FE51C9A000ED1ECB77FA1A28C64AF1DE58D14F397DBF611343D7DC3443E38240663B8690F26F8F1A30BB58A88CCA9EDC4525F4DA0D93D8F2E7FB4623F0
grub_password_unrestricted: true
grub_password_unrestricted_files:
  - /etc/grub.d/10_linux
  - /etc/grub.d/20_linux_xen

# Add your own options below if needed:
# grub_options:
#   - option: cgroup_enable
#     value: memory

Requirements

State of Used Roles

These roles help set up the system, but you can do this in your own way.

Requirement GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab

Context

This role works with many other compatible roles. Check out the documentation of these roles for more details.

Here’s a visual guide to related roles: dependencies

Compatibility

This role has been tested on several container images:

Container Tags
Alpine all
Enterprise Linux 9
Debian all
Fedora all
Ubuntu all

You need at least Ansible version 2.12. Tests have been done with:

  • The previous version.
  • The current version.
  • The development version.

If you encounter any issues, please report them on GitHub.

License

This role is licensed under Apache-2.0.

Author Information

Created by robertdebock.

If you appreciate my work, consider sponsoring me.

Informazioni sul progetto

Configure grub on your system.

Installa
ansible-galaxy install robertdebock.grub
Licenza
apache-2.0
Download
114.2k
Proprietario
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.