Adds or removes a Windows PowerShell module
- This module helps to install Windows PowerShell modules and register custom modules repository on Windows-based systems.
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.
.. seealso:: :ref:`community.windows.win_psrepository_module` The official documentation on the **community.windows.win_psrepository** module.
---
- 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
Common return values are documented here, the following are the fields unique to this module:
- Wojciech Sciesinski (@it-praktyk)
- Daniele Lazzari (@dlazz)