win_psrepository – Adds, removes or updates a Windows PowerShell repository

From Get docs
Ansible/docs/2.9/modules/win psrepository module


win_psrepository – Adds, removes or updates a Windows PowerShell repository

New in version 2.8.


Synopsis

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

Parameters

Parameter Choices/Defaults Comments

installation_policy

string

  • 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

  • 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

Authors

  • Wojciech Sciesinski (@it-praktyk)

Hint

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


© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/win_psrepository_module.html