On 3/19/20 4:23 PM, mahesh g o wrote:
> - hosts: localhost
> gather_facts: false
> vars:
> foo: ['vs1','vs2','vs3','vs4']
> tasks:
> - name: counting the array elements
> yes: "{{foo|length}}"
There is no module called "yes", try "set_fact" or "debug" and make sure your
indentation is correct.
Regards
Racke
>
> 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]
> <mailto:[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
> <https://groups.google.com/d/msgid/ansible-project/5e834a5d-2bb7-4875-b773-591c9a20a6da%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.
--
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/4b0b62f4-446c-1f52-1823-d1286e5fe1f7%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
