--- - name: Ensure required parameters are in /boot/firmware/cmdline.txt hosts: all become: yes tasks: - name: Append kernel parameters to cmdline.txt if not present lineinfile: path: /boot/firmware/cmdline.txt line: "cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory" insertafter: EOF state: present create: yes backup: yes # This creates a backup of the file before making changes notify: - Reboot system handlers: - name: Reboot system reboot: msg: "Rebooting system to apply new kernel parameters" reboot_timeout: 600 test_command: uptime