- Docs »
- win_psmodule - Adds or removes a Powershell Module
-
You are reading an unmaintained version of the Ansible documentation. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See the latest Ansible documentation.
win_psmodule - Adds or removes a Powershell Module
- This module helps to install Powershell modules and register custom modules repository on Windows Server.
Parameter |
Choices/Defaults |
Comments |
allow_clobber
bool |
|
If yes imports all commands, even if they have the same names as commands that already exists. Available only in Powershell 5.1 or higher.
|
name
required |
|
Name of the powershell module that has to be installed.
|
repository
|
|
Name of the custom repository to register or use.
|
state
|
Choices:
- absent
present ←
|
If present a new module is installed.
If absent a module is removed.
|
url
|
|
URL of the custom repository to register.
|
Note
- Powershell 5.0 or higher is needed.
---
- name: Add a powershell module
win_psmodule:
name: PowershellModule
state: present
- name: Add a powershell module and register a repository
win_psmodule:
name: MyCustomModule
repository: MyRepository
url: https://myrepo.com
state: present
- name: Add a powershell module from a specific repository
win_psmodule:
name: PowershellModule
repository: MyRepository
state: present
- name: Remove a powershell module
win_psmodule:
name: PowershellModule
state: absent
- name: Remove a powershell module and a repository
win_psmodule:
name: MyCustomModule
repository: MyRepository
state: absent
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
|
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.