You are on page 1of 2

6/29/2021 Ansible Try it out Loops - apache2, sqlite3, git install - Stack Overflow

Ansible Try it out Loops - apache2, sqlite3, git install


Asked
9 months ago Active
9 months ago Viewed
503 times

---

- name: install apache2, sqlite3, git

0 hosts: localhost

become: yes

tasks:

- name: Install list of packages

action: apt pkg={{item}} state=installed

with_items:

- apache2

- sqlite3

- git

Error Below:

user@workspacexhnc27ngrq5uvvr3:/projects/challenge$ ansible-playbook mainplaybook.yml

ERROR! unexpected parameter type in action: <class


'ansible.parsing.yaml.objects.AnsibleSequence'>

The error appears to be in '/projects/challenge/fresco_loops/tasks/main.yml': line 2, column


3, but may

be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---

- name: install apache2, sqlite3, git

^ here

user@workspacexhnc27ngrq5uvvr3:/projects/challenge$ ansible-playbook mainplaybook.yml

ERROR! unexpected parameter type in action: <class


'ansible.parsing.yaml.objects.AnsibleSequence'>

The error appears to be in '/projects/challenge/fresco_loops/tasks/main.yml': line 2, column


3, but may

be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---

- name: install apache2, sqlite3, git

^ here

ansible

Share Edit Follow Flag edited Sep 8 '20 at 17:39 asked Sep 8 '20 at 17:37
larsks Sravan Kumar
197k 34 300 306 1 1

1 It looks like you may be working from some outdated documentation (playbooks no longer use the
https://stackoverflow.com/questions/63798997/ansible-try-it-out-loops-apache2-sqlite3-git-install 1/2
6/29/2021 Ansible Try it out Loops - apache2, sqlite3, git install - Stack Overflow

action keyword). Maybe start with the docs at docs.ansible.com/ansible/latest/index.html?


– larsks
Sep 8 '20 at 17:40

1 Answer Active Oldest Votes

used the apt module instead of action. Just make sure that you Ansibe user have privileged to
install apt packages on your target system.
0
---

- name: install apache2, sqlite3, git

hosts: localhost

become: yes

tasks:

- name: Install list of packages

apt:

name: "{{item}}"

state: present

with_items:

- apache2

- sqlite3

- git

Share Edit Follow Flag answered Sep 8 '20 at 22:04


idriss Eliguene
549 3 10

https://stackoverflow.com/questions/63798997/ansible-try-it-out-loops-apache2-sqlite3-git-install 2/2

You might also like