Open tjanez opened 4 years ago
I have the same issue. When one have a task in a role with the content:
- name: Install required packages
yum:
name:
- yum-utils
- device-mapper-persistent-data
- lvm2
state: present
Validation error is: Incorrect type. Expected "string".
Though a playbook, using the role, does play without any issues.
The same problem is with the yum
and apt
modules.
In the specific package modules it is mentioned: https://docs.ansible.com/ansible/2.9/modules/yum_module.html#parameter-name
To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages.
https://docs.ansible.com/ansible/2.9/modules/apt_module.html#parameter-name
A list of package names [...]
In Notes for both yum
and apt
When used with a loop: each package will be processed individually, it is much more efficient to pass the list directly to the name option.
Environment
Summary
If one uses a code snippet like:
he would get an error:
While the
package
module documentation doesn't explicitly mention this, it is clear from the Examples section that one could also use a list for thename
parameter.