--- - name: Change Grub default Kernel lineinfile: dest: /etc/default/grub regexp: '^(GRUB_DEFAULT=).*' line: '\g<1>"1>2"' backrefs: yes notify: Run update-grub - name: Remove grub protection ansible.builtin.blockinfile: path: /etc/grub.d/40_custom marker: "# {mark} ANSIBLE MANAGED BLOCK" block: "" notify: Run update-grub