On Tuesday, December 4, 2018 at 10:32:41 AM UTC-7, Kai Stian Olstad wrote:
>
> On Tuesday, 4 December 2018 18:21:23 CET John Harmon wrote: 
> > Perhaps I am doing this wrong, but it doesn't like my syntax.  If I 
> escape 
> > the backslash ('\\w+.img') it tries to run but with a different error: 
> >     - name: Find virtual Disks 
> >       set_fact: 
> >         virt_disks: "{{ lookup('file','/var/ftp/vm.cfg') | 
> > regex_findall('\w+.img') }}" 
> > 
> > Result: 
> > ERROR! Syntax Error while loading YAML. 
> >   found unknown escape character 
> > 
> > The error appears to have been in 
> > '/etc/ansible/playbooks/one-offs/sanitize_vm.yml': line 21, column 75, 
> but 
> > may 
> > be elsewhere in the file depending on the exact syntax problem. 
> > 
> > The offending line appears to be: 
> > 
> >       set_fact: 
> >         virt_disks: "{{ lookup('file','/var/ftp/vm.cfg') | 
> regex_findall('\w+.img') }}" 
>
> <snip /> 
>
> > 
> > 
> > I find the error strange on the last one, because I stat the file 
> previous 
> > to it and can see it fine.   
>
> In your set_fact, try to swap your single quotes to double quotes and you 
> double to single quotes. 
>
>
> -- 
> Kai Stian Olstad 
>
>
>
Now, whether escaped or not it says it can't find the file.  Do I need to 
delegate_to in set_fact? or should it be looking on the host specified?

-- 
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/5aeea2e4-1454-4854-88c7-fece1ef588b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to