Trying to edit grub.conf and add a phrase to the kernel lines. 

*Sample stanza:*

title CentOS (2.6.32-696.13.2.el6.x86_64) 
    root (hd0,0) 
    kernel /vmlinuz-2.6.32-696.13.2.el6.x86_64 ro 
root=/dev/mapper/vg_root-lv_root rd_NO_LUKS rd_LVM_LV=vg_root/lv_root 
LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 console=ttyS0,115200n8 
rd_LVM_LV=vg_root/lv_swap KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb 
quiet rd_NO_DM 
    initrd /initramfs-2.6.32-696.13.2.el6.x86_64.img


Ansible playbook stanza that's not working:

- name: edit_grub_conf 
   lineinfile: 
     path: "/tmp/grub.conf" 
     regexp: "^kernel(.*)?" 
     line: 'kernel\1 transparent_hugepage=never' 
     state: present 
     backrefs: true 
     mode: 0666 

Error reported:

TASK [edit_grub_conf] 
********************************************************** 
fatal: [leviticus]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "Shared connection to leviticus closed.\r\n", 
"module_stdout": "Traceback (most recent call last):\r\n File 
\"/tmp/ansible_PUtMtv/ansible_module_lineinfile.py\", line 470, in 
<module>\r\n main()\r\n File 
\"/tmp/ansible_PUtMtv/ansible_module_lineinfile.py\", line 462, in main\r\n 
ins_aft, ins_bef, create, backup, backrefs)\r\n File 
\"/tmp/ansible_PUtMtv/ansible_module_lineinfile.py\", line 261, in 
present\r\n bre_m = re.compile(to_bytes(regexp, 
errors='surrogate_or_strict'))\r\n File \"/usr/lib64/python2.6/re.py\", 
line 190, in compile\r\n return _compile(pattern, flags)\r\n File 
\"/usr/lib64/python2.6/re.py\", line 245, in _compile\r\n raise error, v # 
invalid expression\r\nsre_constants.error: nothing to repeat\r\n", "msg": 
"MODULE FAILURE", "rc": 0}


What am I missing?

Thanks!

Leam

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cd225a3f-9df4-4d8b-8f92-e9f77af8658d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to