Lookup failing from file

55 views
Skip to first unread message

Anuj Agrawal

unread,
Sep 17, 2014, 11:30:18 AM9/17/14
to ansible...@googlegroups.com
Running a playbook where contents are read from a file. It is an XML file.


Playbook yaml:
---

- hosts: all
  gather_facts: false

  vars:
    XmlFileContents: "{{ lookup('file', 'files/spring-proxy-handler-config.xml') }}"

  tasks:
    - debug: msg="the value of contents is {{XmlFileContents}}"


Error:
fatal: [myhost.com] => A variable inserted a new parameter into the module args. Be sure to quote variables if they contain equal signs (for example: "{{var}}").

It is a xml file containing some config and the file definitely has some equal signs in it. However, I do not understand the error message and, hence, cannot figure out a solution to my problem.

James Cammarata

unread,
Sep 17, 2014, 1:22:32 PM9/17/14
to ansible...@googlegroups.com
Hi Anuj, what version of Ansible are you using?

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CABnk5p3bezHSMtAeNTVC69YuUqxfHnEBhPzzata_qjornjd%2B2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Anuj Agrawal

unread,
Sep 17, 2014, 1:30:26 PM9/17/14
to ansible...@googlegroups.com
On Wed, Sep 17, 2014 at 10:52 PM, James Cammarata <jcamm...@ansible.com> wrote:
Hi Anuj, what version of Ansible are you using?

1.7.1
 

Anuj Agrawal

unread,
Sep 17, 2014, 3:11:54 PM9/17/14
to ansible...@googlegroups.com
Observation: It behaves strangely when there are spaces within a pair of quotes. And, my xml file has spaces within quotes in it.

James Cammarata

unread,
Sep 17, 2014, 3:17:34 PM9/17/14
to ansible...@googlegroups.com
If you do msg="the value of contents is '{{XmlFileContents}}'" does it still raise an error?


Anuj Agrawal

unread,
Sep 17, 2014, 3:25:48 PM9/17/14
to ansible...@googlegroups.com
On Thu, Sep 18, 2014 at 12:47 AM, James Cammarata <jcamm...@ansible.com> wrote:
If you do msg="the value of contents is '{{XmlFileContents}}'" does it still raise an error?

Yes, it still raises the same error.
 

James Cammarata

unread,
Sep 17, 2014, 8:14:09 PM9/17/14
to ansible...@googlegroups.com
Ok, could you open an issue for this on GitHub and I'll take a look at it ASAP. You might also want to try checking out the version from GitHub and see if the issue is resolved there.

Thanks!

Tomasz Kontusz

unread,
Sep 19, 2014, 2:03:01 AM9/19/14
to ansible...@googlegroups.com


Anuj Agrawal <anujag...@gmail.com> napisał:
A workaround for this is using complex args:
- debug:
msg: '{{ XmlFileContents }}'
--
Wysłane za pomocą K-9 Mail.
Reply all
Reply to author
Forward
0 new messages