Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package module should be allowed to have name parameter of type list #260

Open
tjanez opened this issue Jan 3, 2020 · 2 comments · May be fixed by #273
Open

package module should be allowed to have name parameter of type list #260

tjanez opened this issue Jan 3, 2020 · 2 comments · May be fixed by #273

Comments

@tjanez
Copy link

tjanez commented Jan 3, 2020

Environment

  • Extension version: 0.5.2
  • OS Type: Linux

Summary

If one uses a code snippet like:

- name: install the latest version of Apache and MariaDB
  package:
    name:
      - httpd
      - mariadb-server
    state: latest

he would get an error:

Incorrect type. Expected "string".

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 the name parameter.

@yerzhant
Copy link

yerzhant commented Apr 1, 2020

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.

@pgassmann
Copy link

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.

slovdahl added a commit to slovdahl/vscode-ansible that referenced this issue Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants