community.windows.win_psmodule – Adds or removes a Windows PowerShell module
community.windows.win_psmodule – Adds or removes a Windows PowerShell module
Note
This plugin is part of the community.windows collection (version 1.2.0).
To install it use: ansible-galaxy collection install community.windows
.
To use it in a playbook, specify: community.windows.win_psmodule
.
Synopsis
- This module helps to install Windows PowerShell modules and register custom modules repository on Windows-based systems.
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
allow_clobber boolean |
|
If |
allow_prerelease boolean |
|
If It doesn't work with the parameters It doesn't work with the |
maximum_version string |
The maximum version of the PowerShell module that has to be installed. | |
minimum_version string |
The minimum version of the PowerShell module that has to be installed. | |
name string / required |
Name of the Windows PowerShell module that has to be installed. | |
repository string |
Name of the custom repository to use. | |
required_version string |
The exact version of the PowerShell module that has to be installed. | |
skip_publisher_check boolean |
|
If |
state string |
|
If If If |
url string |
URL of the custom repository to register. DEPRECATED, will be removed in a major release after |
Notes
Note
- PowerShell modules needed - PowerShellGet >= 1.6.0 - PackageManagement >= 1.1.7
- PowerShell package provider needed - NuGet >= 2.8.5.201
- On PowerShell 5.x required modules and a package provider will be updated under the first run of the win_psmodule module.
- On PowerShell 3.x and 4.x you have to install them before using the win_psmodule.
See Also
See also
- community.windows.win_psrepository
- The official documentation on the community.windows.win_psrepository module.
Examples
---
- name: Add a PowerShell module
community.windows.win_psmodule:
name: PowerShellModule
state: present
- name: Add an exact version of PowerShell module
community.windows.win_psmodule:
name: PowerShellModule
required_version: "4.0.2"
state: present
- name: Install or update an existing PowerShell module to the newest version
community.windows.win_psmodule:
name: PowerShellModule
state: latest
- name: Install newer version of built-in Windows module
community.windows.win_psmodule:
name: Pester
skip_publisher_check: yes
state: present
- name: Add a PowerShell module and register a repository
community.windows.win_psmodule:
name: MyCustomModule
repository: MyRepository
state: present
- name: Add a PowerShell module from a specific repository
community.windows.win_psmodule:
name: PowerShellModule
repository: MyRepository
state: present
- name: Remove a PowerShell module
community.windows.win_psmodule:
name: PowerShellModule
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
nuget_changed boolean |
always |
True when Nuget package provider is installed.
Sample: True |
output string |
always |
A message describing the task result.
Sample: Module PowerShellCookbook installed |
repository_changed boolean |
always |
True when a custom repository is installed or removed.
Sample: True |
Authors
- Wojciech Sciesinski (@it-praktyk)
- Daniele Lazzari (@dlazz)
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/windows/win_psmodule_module.html