New in version 2.4.
Parameter | Choices/Defaults | Comments |
---|---|---|
allow_clobber
boolean
|
|
If
yes allows install modules that contains commands those have the same names as commands that already exists. |
allow_prerelease
boolean
added in 2.8 |
|
If
yes installs modules marked as prereleases.It doesn't work with the parameters
minimum_version and/or maximum_version .It doesn't work with the
state set to absent. |
maximum_version
string
added in 2.8 |
The maximum version of the PowerShell module that has to be installed.
|
|
minimum_version
string
added in 2.8 |
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
added in 2.8 |
The exact version of the PowerShell module that has to be installed.
|
|
skip_publisher_check
boolean
added in 2.8 |
|
If
yes , allows you to install a different version of a module that already exists on your computer in the case when a different one is not digitally signed by a trusted publisher and the newest existing module is digitally signed by a trusted publisher. |
state
string
|
|
If
present a new module is installed.If
absent a module is removed.If
latest a module is updated to the newest version. This option was added in version 2.8. |
url
string
|
URL of the custom repository to register.
This option is deprecated and will be removed in Ansible 2.12. Use the win_psrepository module instead.
|
Note
See also
---
- name: Add a PowerShell module
win_psmodule:
name: PowerShellModule
state: present
- name: Add an exact version of PowerShell module
win_psmodule:
name: PowerShellModule
required_version: "4.0.2"
state: present
- name: Install or update an existing PowerShell module to the newest version
win_psmodule:
name: PowerShellModule
state: latest
- name: Install newer version of built-in Windows module
win_psmodule:
name: Pester
skip_publisher_check: yes
state: present
- name: Add a PowerShell module and register a repository
win_psmodule:
name: MyCustomModule
repository: MyRepository
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
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
|
Hint
If you notice any issues in this documentation you can edit this document to improve it.