community / community.windows / 2.2.0 / module / win_psrepository Adds, removes or updates a Windows PowerShell repository. Authors: Wojciech Sciesinski (@it-praktyk), Brian Scholer (@briantist)community.windows.win_psrepository (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 add, remove and update Windows PowerShell repository on Windows-based systems.
--- - name: Ensure the required NuGet package provider version is installed ansible.windows.win_shell: Find-PackageProvider -Name Nuget -ForceBootstrap -IncludeDependencies -Force
- name: Register a PowerShell repository community.windows.win_psrepository: name: MyRepository source_location: https://myrepo.com state: present
- name: Remove a PowerShell repository community.windows.win_psrepository: name: MyRepository state: absent
- name: Add an untrusted repository community.windows.win_psrepository: name: MyRepository installation_policy: untrusted
- name: Add a repository with different locations community.windows.win_psrepository: name: NewRepo source_location: https://myrepo.example/module/feed script_source_location: https://myrepo.example/script/feed publish_location: https://myrepo.example/api/module/publish script_publish_location: https://myrepo.example/api/script/publish
- name: Update only two properties on the above repository community.windows.win_psrepository: name: NewRepo installation_policy: untrusted script_publish_location: https://scriptprocessor.example/publish
- name: Clear script locations from the above repository by re-registering it community.windows.win_psrepository: name: NewRepo installation_policy: untrusted source_location: https://myrepo.example/module/feed publish_location: https://myrepo.example/api/module/publish force: True
- name: Register a PowerShell repository with credentials community.windows.win_psrepository: name: MyRepository source_location: https://myrepo.com state: present username: repo_username password: repo_password
name: description: - Name of the repository to work with. required: true type: str force: default: false description: - If C(True), any differences from the desired state will result in the repository being unregistered, and then re-registered. - I(force) has no effect when I(state=absent). See notes for additional context. type: bool proxy: description: - Proxy to use for repository. required: false type: str version_added: 1.1.0 version_added_collection: community.windows state: choices: - absent - present default: present description: - If C(present) a new repository is added or updated. - If C(absent) a repository is removed. 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 source_location: aliases: - source description: - 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. - Required when registering a new repository or using I(force=True). type: str publish_location: description: - Specifies the URI for publishing modules to this repository. type: str installation_policy: choices: - trusted - untrusted description: - Sets the C(InstallationPolicy) of a repository. - Will default to C(trusted) when creating a new repository or used with I(force=True). type: str script_source_location: description: - Specifies the URI for discovering and installing scripts from this repository. type: str script_publish_location: description: - Specifies the URI for publishing scripts to this repository. type: str