Does your 'name' line in your apt task needs to be indented?
- name install standard stuff
apt:
name: {{ applications }}
... should be ...
- name install standard stuff
apt:
name: {{ applications }}
Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123
On Aug 19, 2022, at 9:24 AM, Kevin Shumaker
<[email protected]<mailto:[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]<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/60f750dd-4fb6-4552-ae3d-1114c0137983n%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F60f750dd-4fb6-4552-ae3d-1114c0137983n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C35e717b2711f4df7980f08da81e61bdf%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637965122557302076%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sl9yX2X1IbxaMA%2BY6N7PbEyAJ00a1b82C0%2B6GwgQ3L0%3D&reserved=0>.
--
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/0255CC05-C63A-4A30-B363-D1637F1DFD04%40nist.gov.