We could be wrong, but this one looks like it might be an issue with missing quotes.

3,160 views
Skip to first unread message

Andrew Holway

unread,
Apr 15, 2014, 5:37:10 PM4/15/14
to ansible...@googlegroups.com
Hi,

I cant get past this error. I've tried various combinations of quotes but to no avail.

Any ideas?

ta,

Andrew


[root@ansible ansible-catn-freeipa]# ansible-playbook freeipa.yml -i hosts
ERROR: Syntax Error while loading YAML script, /root/ansible-catn-freeipa/roles/replica/tasks/free-ipa-setup.yml
Note: The error may actually appear before this position: line 36, column 9

name: Pull file from ansible server
  - copy: "src=/tmp/{{ freeipaserver_ip }}/var/lib/ipa/replica-info-{{ ansible_hostname }}.gpg dest=/var/lib/ipa/replica-info-{{ ansible_hostname }}.gpg owner=foo group=foo mode=0644"
        ^
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they 
start a value. For instance:            

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"     

James Tanner

unread,
Apr 15, 2014, 5:59:17 PM4/15/14
to ansible...@googlegroups.com
If foo is a list, then do this ...

with_items: foo

Andrew Holway

unread,
Apr 15, 2014, 6:03:21 PM4/15/14
to ansible...@googlegroups.com
Hi, please ignore the foo stuff. This spat out with the error.

- copy: "src=/tmp/{{ freeipaserver_ip }}/var/lib/ipa/replica-info-{{
ansible_hostname }}.gpg dest=/var/lib/ipa/replica-info-{{
ansible_hostname }}.gpg owner=foo group=foo mode=0644"

This is causing the error.
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/GGmm9nMelLo/unsubscribe.
> To unsubscribe from this group and all its topics, 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/a3651982-6563-4cf7-8dd7-d04d8e723467%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

James Tanner

unread,
Apr 15, 2014, 6:04:28 PM4/15/14
to ansible...@googlegroups.com
Also the hypen should be in front of name: and copy: should be aligned with name:

- name: blah
  copy:


On Tuesday, April 15, 2014 5:37:10 PM UTC-4, Andrew Holway wrote:

James Tanner

unread,
Apr 15, 2014, 6:05:45 PM4/15/14
to ansible...@googlegroups.com
Also, you don't need to quote the entire argset:


copy: src=/tmp/"{{ freeipaserver_ip }}"/var/lib/ipa/replica-info-"{{ ansible_hostname }}".gpg dest=/var/lib/ipa/replica-
info-"{{ ansible_hostname }}".gpg owner=foo group=foo mode=0644


On Tuesday, April 15, 2014 5:37:10 PM UTC-4, Andrew Holway wrote:

Michael DeHaan

unread,
Apr 15, 2014, 6:34:10 PM4/15/14
to ansible...@googlegroups.com
Definitely don't quote individuals like this, you'll end up with quotes in the paths!

copy: src=/tmp/"{{ freeipaserver_ip }}"/var/lib/ipa/replica-info-"{{ ansible_hostname }}".gpg dest=/var/lib/ipa/replica-
info-"{{ ansible_hostname }}".gpg owner=foo group=foo mode=0644

--
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.

Brian Coca

unread,
Apr 15, 2014, 8:38:17 PM4/15/14
to ansible...@googlegroups.com
have you tried?

  with_items:
      - foo

Andrew Holway

unread,
Apr 16, 2014, 3:16:20 AM4/16/14
to ansible...@googlegroups.com
As I said. I have tried many combinations of quotes (including no
quotes) to make this work. It currently looks like this:

name: Pull file from ansible server
- copy: "src=/tmp/{{ freeipaserver_ip }}/var/lib/ipa/replica-info-{{
ansible_hostname }}.gpg dest=/var/lib/ipa/replica-info-{{
ansible_hostname }}.gpg owner=foo group=foo mode=0644"

But I am still getting this error.

ERROR: Syntax Error while loading YAML script,
/root/ansible-catn-freeipa/roles/replica/tasks/free-ipa-setup.yml
Note: The error may actually appear before this position: line 36, column 1

name: Pull file from ansible server
- copy: "src=/tmp/{{ freeipaserver_ip }}/var/lib/ipa/replica-info-{{
ansible_hostname }}.gpg dest=/var/lib/ipa/replica-info-{{
ansible_hostname }}.gpg owner=foo group=foo mode=0644"
^
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:


> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/GGmm9nMelLo/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CADn%2BHsxYpjrvuz7ycskNTzPLwKetcm%3Dd%2BCyDrwK%3DX15MSXZh_Q%40mail.gmail.com.

Michael DeHaan

unread,
Apr 16, 2014, 10:16:47 PM4/16/14
to ansible...@googlegroups.com
This may be your email wrapping things, but this looks bad to me.

Can you share what you have on gist.github.com so we can see instead?

Instead of this:

- copy: "src=/tmp/{{ freeipaserver_ip }}/var/lib/ipa/replica-info-{{
ansible_hostname }}.gpg dest=/var/lib/ipa/replica-info-{{
ansible_hostname }}.gpg owner=foo group=foo mode=0644"

I would do this:

    - copy: 
         src: /tmp/{{ freeipaserver_ip }}/var/lib/ipa/replica-info-{{ansible_hostname }}.gpg
         dest: /var/lib/ipa/replica-
info-{{ ansible_hostname }}.gpg owner=foo group=foo 
         mode: "0644"

You could also use equal signs instead of the colons.

Just wondering if the indents are actually what's freaking out the parser, but I'd need to see unformatted by your email program.







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.
Reply all
Reply to author
Forward
0 new messages