# I need assistance with vars, lists, and apt

**URL:** <https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011>\
**Category:** Ansible Project\
**Created:** [August 19, 2022, 1:24pm UTC](https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011 "2022-08-19T13:24:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Shumaker](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@Kevin\_Shumaker](https://forum.ansible.com/u/Kevin_Shumaker)\
**Post date:** [August 19, 2022, 1:24pm UTC](https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011/1 "2022-08-19T13:24:06Z")

</div>

New user of ansible. I’ve tried several playbooks to use as templates.  
My goal is to create a vars.yml with the following:  
= = = = =

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [August 19, 2022, 1:49pm UTC](https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011/2 "2022-08-19T13:49:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin\_Shumaker](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@Kevin\_Shumaker](https://forum.ansible.com/u/Kevin_Shumaker)\
**Post date:** [August 19, 2022, 2:16pm UTC](https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011/3 "2022-08-19T14:16:21Z")

</div>

Wow, thanks for the speedy reply!

Unfortunately for me, that didn’t work (adding 2 spaces further indent on the line " name: {{ applications }} " although it does make sense.  
I still get the same error, at the same point. Kinda frustrating when the keyword “name:” can be used for several different functions.

as an aside, and in a different, non-clean, non-easy to maintain, but to prove to me that ansible can work, sorta, I created the playbook with separate install lines for each app in the playbook:

tasks:

- name: install app1  
apt: name=app1 state=present
- name: install app2  
apt: name=app2 state=present

but I’m at 20 apps, and haven’t even begun the setup commands, and copy files, yet, and the playbook is becoming unwieldy, so the vars list setup would be of great assistance…

Thanks again for the speedy reply, though.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [August 19, 2022, 2:47pm UTC](https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011/4 "2022-08-19T14:47:31Z")

</div>

“- name install standard stuff” should be “- name: install standard stuff”.  
You’re missing a colon.

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [August 19, 2022, 2:47pm UTC](https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011/5 "2022-08-19T14:47:42Z")

</div>

You specify the what. You don’t specify the action. You need a state (ie present, absent, etc).

> - name install standard stuff  
> apt:
> 
> name: {{ applications }}
> 
> state: present

Walter

---

<div class="post-metadata">

**Author:** ![Kevin\_Shumaker](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@Kevin\_Shumaker](https://forum.ansible.com/u/Kevin_Shumaker)\
**Post date:** [August 19, 2022, 3:08pm UTC](https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011/6 "2022-08-19T15:08:47Z")

</div>

Ding! Ding! Ding! I need to get my eyes checked… That was the issue! Missing the ‘:’. The list works as expected, now.

I use Pi-Gen to create my custom OS, but I think Ansible is going to be my replacement, as it does all that Pi-Gen does, but allows me to do it to any of my Linux machines.

Thank you for your rapid response. My hair thanks you, too…

---

<div class="post-metadata">

**Author:** ![Kevin\_Shumaker](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@Kevin\_Shumaker](https://forum.ansible.com/u/Kevin_Shumaker)\
**Post date:** [August 19, 2022, 3:29pm UTC](https://forum.ansible.com/t/i-need-assistance-with-vars-lists-and-apt/37011/7 "2022-08-19T15:29:38Z")

</div>

Thank you sir. I am not sure why, but it works with or without the status: line. Todd found what was breaking my playbook, though. I did add the status: line just to be consistent, and for readability in the future.

I appreciate both of your assistance, and I hope to contribute in the future.
