win_psrepository – Adds, removes or updates a Windows PowerShell repository — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# win_psrepository – Adds, removes or updates a Windows PowerShell repository

New in version 2.8.

- Synopsis
- Parameters
- Notes
- See Also
- Examples
- Status

## Synopsis

- This module helps to add, remove and update Windows PowerShell repository on Windows-based systems.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
installation_policy string | Choices: trusted untrusted | Sets the `InstallationPolicy` of a repository. Will default to `trusted` when creating a new repository.
name string / required |  | Name of the repository to work with.
source string |  | Specifies the URI for discovering and installing modules from this repository. A URI can be a NuGet server feed (most common situation), HTTP, HTTPS, FTP or file location.
state string | Choices: absent present ← | If `present` a new repository is added or updated. If `absent` a repository is removed.

## Notes

Note

- PowerShell modules needed - PowerShellGet >= 1.6.0 - PackageManagement >= 1.1.7
- PowerShell package provider needed - NuGet >= 2.8.5.201
- See the examples on how to update the NuGet package provider.
- You can not use `win_psrepository` to re-register (add) removed PSGallery, use the command `Register-PSRepository -Default` instead.

## See Also

See also

win_psmodule – Adds or removes a Windows PowerShell module
  The official documentation on the win_psmodule module.

## Examples

    ---
    - name: Ensure the required NuGet package provider version is installed
      win_shell: Find-PackageProvider -Name Nuget -ForceBootstrap -IncludeDependencies -Force

    - name: Add a PowerShell module and register a repository
      win_psrepository:
        name: MyRepository
        source: https://myrepo.com
        state: present

    - name: Remove a PowerShell repository
      win_psrepository:
        name: MyRepository
        state: absent

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Wojciech Sciesinski (@it-praktyk)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.