On Thursday, March 21, 2019 at 12:11:00 PM UTC-6, Kai Stian Olstad wrote:
>
> On 21.03.2019 18:10, John Harmon wrote: 
> > I have tried single quotes too around the regexp, but get a similar 
> issue 
> > 
> > TASK [dns_update : include_tasks] 
> > 
> ********************************************************************************************************************************************************************************************************
>  
>
> > fatal: [ansible-ub18]: FAILED! => {"reason": "Syntax Error while loading 
> > YAML.\n  found unknown escape character\n\nThe error appears to have 
> been 
> > in '/etc/ansible/role/dns_update/tasks/Ubuntu18.yml': line 7, column 15, 
> > but may\nbe elsewhere in the file depending on the exact syntax 
> > problem.\n\nThe offending line appears to be:\n\n    regexp: 
> > '.*nameservers.*$\\n.*addresses:(.*$)'\n    replace: \"\\1 {{ dns1 }}, 
> {{ 
> > dns 2}}\"\n              ^ here\nWe could be wrong, but this one looks 
> like 
> > it might be an issue with\nmissing quotes.  Always quote template 
> > expression brackets when they\nstart a value. For instance:\n\n 
> >   with_items:\n      - {{ foo }}\n\nShould be written as:\n\n 
> >   with_items:\n      - \"{{ foo }}\"\n"} 
> > 
>
> If you add this sed to correct the formatting somewhat 
>   ansible-playbook playbbok.yml | sed 's/\\n/\n/g' 
>
> you'll see that is pointing to your double quote in the replace line. 
>
>
> -- 
> Kai Stian Olstad 
>

Thx all.  Those helped.  I now get it to replace, but it replaces my string 
and not just my backref.   Not sure what I am doing wrong.  I think that is 
just the default behavior of replace.  Can't use quantifiers with negative 
look aheads/behinds. 

-- 
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/26b38385-cc46-4646-9a9a-e3762a4e3b4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to