use of multiple chocolatey package names (#28046)

* use of multiple chocolatey package names

It might be helpful to users, to clarify whether/when <name:> must specify a single package.

Users who are familiar with chocolatey may be accustomed to installing multiple packages in a single invocation of 'choco install'.

I believe win_chocolatey currently accepts multiple package names when state: is latest or present.
For instance, this appears to work currently:

  - win_chocolatey:
      name: >-
        pscx
        windirstat
      state: latest

However, when state: is absent, uninstall is not performed if multiple package are specified.
The chocolate.log output suggests that chocolatey is treating the multiple packages as an 'exact' name of a single package name:
2017-08-10 19:04:04,087 2424 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" list --local-only --exact pscx windirstat
2017-08-10 19:04:04,087 2424 [DEBUG] - Received arguments: list --local-only --exact pscx windirstat

I find the current behavior helpful in terms of accepting multiple package names, even if uninstall must be treated differently.
It might be helpful to show an example of how multiple uninstalls can be handled by looping over them. 

  - win_chocolatey:
      name: "{{ item }}"
      state: absent
    with_items:
      - pscx
      - windirstat

* revise per Jordan Borean. remote colon (:) from text. revise formating.

* Update win_chocolatey.py
pull/22462/merge
Rich Murphey 7 years ago committed by Jordan Borean
parent 241d38077f
commit 88ccaf106b

@ -38,6 +38,7 @@ options:
name:
description:
- Name of the package to be installed.
- This must be a single package name.
required: yes
state:
description:
@ -147,4 +148,20 @@ EXAMPLES = r'''
win_chocolatey:
name: git
state: absent
- name: install multiple packages
win_chocolatey:
name: "{{ item }}"
state: absent
with_items:
- pscx
- windirstat
- name: uninstall multiple packages
win_chocolatey:
name: "{{ item }}"
state: absent
with_items:
- pscx
- windirstat
'''

Loading…
Cancel
Save