ansible.builtin.win_psmodule (v2.6.20) — module

Adds or removes a Powershell Module

| "added in version" 2.4 of ansible.builtin"

Authors: Daniele Lazzari

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.6.20

Description

This module helps to install Powershell modules and register custom modules repository on Windows Server.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- name: Add a powershell module
  win_psmodule:
    name: PowershellModule
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a powershell module and register a repository
  win_psmodule:
    name: MyCustomModule
    repository: MyRepository
    url: https://myrepo.com
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a powershell module from a specific repository
  win_psmodule:
    name: PowershellModule
    repository: MyRepository
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a powershell module
  win_psmodule:
    name: PowershellModule
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a powershell module and a repository
  win_psmodule:
    name: MyCustomModule
    repository: MyRepository
    state: absent

Inputs

    
url:
    description:
    - URL of the custom repository to register.

name:
    description:
    - Name of the powershell module that has to be installed.
    required: true

state:
    choices:
    - absent
    - present
    default: present
    description:
    - If C(present) a new module is installed.
    - If C(absent) a module is removed.

repository:
    description:
    - Name of the custom repository to register or use.

allow_clobber:
    default: 'no'
    description:
    - If C(yes) imports all commands, even if they have the same names as commands that
      already exists. Available only in Powershell 5.1 or higher.
    type: bool

Outputs

nuget_changed:
  description: true when Nuget package provider is installed
  returned: always
  sample: true
  type: boolean
output:
  description: a message describing the task result.
  returned: always
  sample: Module PowerShellCookbook installed
  type: string
repository_changed:
  description: true when a custom repository is installed or removed
  returned: always
  sample: true
  type: boolean