name: disable THP (RedHat)
lineinfile: dest=/boot/grub/grub.conf
backup=True
backrefs=True
state=present
regexp='(^\s+kernel(\s+(?!transparent_hugepage=never)[\w=/\-\.\,\_]+)*)\s*$'
line='\1 transparent_hugepage=never'
Each time I run the play it will add "transparent_hugepage=never" to a single line where it is not found, instead of every line that starts with kernel. Please suggest how to update this string in all the line that starts with Kernel.
Thanks
Thanks