"- name install standard stuff" should be "- name: install standard stuff".
You're missing a colon.

On Friday, August 19, 2022 at 9:24:06 AM UTC-4 [email protected] wrote:

> New user of ansible. I've tried several playbooks to use as templates.
> My goal is to create a vars.yml with the following:
> = = = = =
> ---
> applications:
>    - app1
>    - app2
>    - app3
>    - and so on
> ...
> = = = = =
> and file inventory contains list of new_machines (with appropriate link in 
> ansible.cfg)
>
> to be used in a playbook thusly:
> = = = = =
> - hosts: new_machines
>   become: true
>
>   vars_files:
>     - /opt/ansible/vars.yml
>
>   pre_tasks:
>     - name: Update Cache if needed
>       apt: update_cache=true cache_valid_time=2600
>
>   tasks:
>     - name install standard stuff
>       apt:
>       name: {{ applications }}
> ...
> = = = = =
> but I always get an error:
> ERROR! We were unable to read either as JSON nor YAML, these are the 
> errors we got from each:
> JSON: Expecting value: line 1 column 1 (char 0)
>
> Syntax Error while loading YAML.
>   mapping values are not allowed in this context
>
> The error appears to be in '/opt/ansible/new_pi.yml': line 14, column 10, 
> but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
>     - name install standard stuff
>       apt:
>          ^ here
> pointing to the colon after apt. I've tried several different types, but 
> all fail the same way. 
>
> I've spent several days, off and on, looking through the docs and 
> suggestions in the docs.ansible site (awesome resource) but my google-fu 
> fails me, and I am looking for suggestions, either for keyword or phrases 
> to seach for, or suggestions on solutions...
> Thanks.
>

-- 
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/6b35c7e2-2cea-42d0-bdfb-88fdf5178323n%40googlegroups.com.

Reply via email to