diff --git a/defaults/main.yml b/defaults/main.yml index eca17a1..d39fd61 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,6 +13,8 @@ locales_list: domain_name: '{{ ansible_domain }}' +configure_grub_cmdline_parameters: false +grub_cmdline_additional_parameters: "" sysctl_custom_file: /etc/sysctl.d/90-custom-values.conf sysctl_opts_reload: yes sysctl_custom_file_state: present diff --git a/tasks/grub_cmdline_parameters.yml b/tasks/grub_cmdline_parameters.yml new file mode 100644 index 0000000..5a655b3 --- /dev/null +++ b/tasks/grub_cmdline_parameters.yml @@ -0,0 +1,18 @@ +- name: grub_cmdline_parameters | Manage additional grub command line options + tags: + - grub + - kernel + block: + - name: grub_cmdline_parameters | Install the grub command line configuration + ansible.builtin.template: + src: grub_cmdline.cfg.j2 + dest: /etc/grub.d/99-grub-ansible-cmdline.cfg + owner: root + group: root + mode: "0644" + when: configure_grub_cmdline_parameters + - name: grub_cmdline_parameters | Remove the custom grub command line configuration + ansible.builtin.file: + dest: /etc/grub.d/99-grub-ansible-cmdline.cfg + state: absent + when: not configure_grub_cmdline_parameters diff --git a/tasks/main.yml b/tasks/main.yml index f22b889..139081b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,6 +9,8 @@ ansible.builtin.import_tasks: timezone.yml - name: Sysctl kernel parameters ansible.builtin.import_tasks: sysctl.yml +- name: Grub command line parameters + ansible.builtin.import_tasks: grub_cmdline_parameters.yml - name: Additional network interfaces ansible.builtin.import_tasks: network-interfaces.yml - name: Create a directory that will contain the local generated certificates diff --git a/templates/grub_cmdline.cfg.j2 b/templates/grub_cmdline.cfg.j2 new file mode 100644 index 0000000..b35ee6e --- /dev/null +++ b/templates/grub_cmdline.cfg.j2 @@ -0,0 +1 @@ +GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT {{ grub_cmdline_additional_parameters }}"