community / community.windows / 2.2.0 / module / win_psmodule Adds or removes a Windows PowerShell module Authors: Wojciech Sciesinski (@it-praktyk), Daniele Lazzari (@dlazz)community.windows.win_psmodule (2.2.0) — module
Install with ansible-galaxy collection install community.windows:==2.2.0
collections: - name: community.windows version: 2.2.0
This module helps to install Windows PowerShell modules and register custom modules repository on Windows-based systems.
--- - 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: Add a PowerShell module from a specific repository with credentials win_psmodule: name: PowerShellModule repository: MyRepository username: repo_username password: repo_password state: present
- name: Remove a PowerShell module community.windows.win_psmodule: name: PowerShellModule state: absent
name: description: - Name of the Windows PowerShell module that has to be installed. required: true type: str force: default: false description: - Overrides warning messages about module installation conflicts - If there is an existing module with the same name and version, force overwrites that version - Corresponds to the C(-Force) parameter of C(Install-Module). - If module as dependency, it will also force reinstallation of dependency. Updating them to latest if version isn't specified in module manifest. required: false type: bool version_added: 1.13.0 version_added_collection: community.windows state: choices: - absent - latest - present default: present description: - If C(present) a new module is installed. - If C(absent) a module is removed. - If C(latest) a module is updated to the newest version. type: str password: description: - Password to authenticate against private repository. required: false type: str version_added: 1.10.0 version_added_collection: community.windows username: description: - Username to authenticate against private repository. required: false type: str version_added: 1.10.0 version_added_collection: community.windows repository: description: - Name of the custom repository to use. type: str allow_clobber: default: false description: - If C(yes) allows install modules that contains commands those have the same names as commands that already exists. type: bool accept_license: default: false description: - Accepts the module's license. - Required for modules that require license acceptance, since interactively answering the prompt is not possible. - Corresponds to the C(-AcceptLicense) parameter of C(Install-Module). - Installation of a module or a dependency that requires license acceptance cannot be detected in check mode, but will cause a failure at runtime unless I(accept_license=true). required: false type: bool version_added: 1.11.0 version_added_collection: community.windows maximum_version: description: - The maximum version of the PowerShell module that has to be installed. type: str minimum_version: description: - The minimum version of the PowerShell module that has to be installed. type: str allow_prerelease: default: false description: - If C(yes) installs modules marked as prereleases. - It doesn't work with the parameters C(minimum_version) and/or C(maximum_version). - It doesn't work with the C(state) set to absent. type: bool required_version: description: - The exact version of the PowerShell module that has to be installed. type: str skip_publisher_check: default: false description: - If C(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. type: bool
nuget_changed: description: True when Nuget package provider is installed. returned: always sample: true type: bool output: description: A message describing the task result. returned: always sample: Module PowerShellCookbook installed type: str repository_changed: description: True when a custom repository is installed or removed. returned: always sample: true type: bool