I need assistance with vars, lists, and apt

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

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

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.

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

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

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…

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.