Try taking our the \n. I have just had a similar problem with blockinfile. Last 
I checked, there is an open bug for the issue.

On Mar 21, 2021, at 21:07, janaki raman <janakirama...@gmail.com> wrote:


Hi All,

 lineinfile duplicates the entry... I am trying to append a line based on the 
regex... but if i run the playbook again, it keeps adding the lines...

- name: "Updating /etc/default/grub with security parameters"
     lineinfile:
       path: /etc/default/grub_new
       backrefs: yes
       state: present
       regexp: '(^GRUB_CMDLINE_LINUX_DEFAULT=.*)$'
       line: '\1\nnuma_balancing=disable'


I tried the same with replace module, still got the same result.. Not sure what 
am i missing here

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com 
<mailto:ansible-devel+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/0cfe076a-49ce-4332-9f96-21821afd3c3cn%40googlegroups.com
 
<https://groups.google.com/d/msgid/ansible-devel/0cfe076a-49ce-4332-9f96-21821afd3c3cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/65600672-78B8-47B0-994F-B0F6DCDCE7F6%40actius.com.

Reply via email to