I'm learning Ansible for a new project, and I'm stuck on what looks like a 
basic issue.  
Using lineinfile with backrefs and \1 doesn't work for me.

Simplified playbook to comment out a line starting with "This":
---
- hosts: localhost
  tasks:
  - name: comment out This
    lineinfile: dest=test.txt backrefs=yes regexp='^This.*' line='#\\1'

test.txt file:
Nothing special
This is a test
Nothing special

Result of: "ansible-playbook edit5.yml"
Nothing special
#\
Nothing special

I've tried single, double, 4 \'s.  Single \ gives an error "invalid group 
reference".  3 gives "#\1", 4 gives "#\" again.
I've been googling for an answer, but all the excerpts I see give similar 
results.  Other characters other than # work the same.
I am running Ansible 1.9.4 on RHEL 6.7.  I also tried replace: with similar 
results.

Thank you!
Boyd

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/24129fc3-a557-46e4-bec9-6f6f04e2decd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to