On this page
win_psmodule - Adds or removes a Powershell Module.
New in version 2.4.
Synopsis
- This module helps to install Powershell modules and register custom modules repository on Windows Server.
Options
parameter | required | default | choices | comments |
---|---|---|---|---|
allow_clobber |
no |
|
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 |
yes |
Name of the powershell module that has to be installed.
|
||
repository |
no |
Name of the custom repository to register.
|
||
state |
no | present |
|
If present a new module is installed. If absent a module is removed.
|
url |
no |
Url of the custom repository.
|
Examples
---
- 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: 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
Return Values
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
nuget_changed |
true when Nuget package provider is installed
|
always | boolean | True |
output |
a message describing the task result.
|
always | string | Module PowerShellCookbook installed |
repository_changed |
true when a custom repository is installed or removed
|
always | boolean | True |
Notes
Note
- Powershell 5.0 or higer is needed.
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/win_psmodule_module.html