- hosts: localhost
  gather_facts: false
  vars:
    foo: ['vs1','vs2','vs3','vs4']
  tasks:
    - name: counting the array elements
        yes: "{{foo|length}}"

seeing the below error: not sure what am i missing here:

ERROR! Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to be in '/root/ansible/playbooks/syst/lab.yml': line 7, 
column 12, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - name: counting the array elements
        yes: "{{foo}}"|length
           ^ here
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 }}"


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5e834a5d-2bb7-4875-b773-591c9a20a6da%40googlegroups.com.

Reply via email to