1#!/usr/local/bin/python3.8 2# -*- coding: utf-8 -*- 3 4# Copyright: (c) 2020, Brian Scholer <@briantist> 5# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 6 7DOCUMENTATION = r''' 8--- 9module: win_psrepository_info 10short_description: Gather information about PSRepositories 11description: 12 - Gather information about all or a specific PSRepository. 13options: 14 name: 15 description: 16 - The name of the repository to retrieve. 17 - Supports any wildcard pattern supported by C(Get-PSRepository). 18 - If omitted then all repositories will returned. 19 type: str 20 default: '*' 21requirements: 22 - C(PowerShellGet) module 23seealso: 24 - module: community.windows.win_psrepository 25author: 26 - Brian Scholer (@briantist) 27''' 28 29EXAMPLES = r''' 30- name: Get info for a single repository 31 community.windows.win_psrepository_info: 32 name: PSGallery 33 register: repo_info 34 35- name: Find all repositories that start with 'MyCompany' 36 community.windows.win_psrepository_info: 37 name: MyCompany* 38 39- name: Get info for all repositories 40 community.windows.win_psrepository_info: 41 register: repo_info 42 43- name: Remove all repositories that don't have a publish_location set 44 community.windows.win_psrepository: 45 name: "{{ item }}" 46 state: absent 47 loop: "{{ repo_info.repositories | rejectattr('publish_location', 'none') | list }}" 48''' 49 50RETURN = r''' 51repositories: 52 description: 53 - A list of repositories (or an empty list is there are none). 54 returned: always 55 type: list 56 elements: dict 57 contains: 58 name: 59 description: 60 - The name of the repository. 61 type: str 62 sample: PSGallery 63 installation_policy: 64 description: 65 - The installation policy of the repository. The sample values are the only possible values. 66 type: str 67 sample: 68 - Trusted 69 - Untrusted 70 trusted: 71 description: 72 - A boolean flag reflecting the value of C(installation_policy) as to whether the repository is trusted. 73 type: bool 74 package_management_provider: 75 description: 76 - The name of the package management provider for this repository. 77 type: str 78 sample: NuGet 79 provider_options: 80 description: 81 - Provider-specific options for this repository. 82 type: dict 83 source_location: 84 description: 85 - The location used to find and retrieve modules. This should always have a value. 86 type: str 87 sample: https://www.powershellgallery.com/api/v2 88 publish_location: 89 description: 90 - The location used to publish modules. 91 type: str 92 sample: https://www.powershellgallery.com/api/v2/package/ 93 script_source_location: 94 description: 95 - The location used to find and retrieve scripts. 96 type: str 97 sample: https://www.powershellgallery.com/api/v2/items/psscript 98 script_publish_location: 99 description: 100 - The location used to publish scripts. 101 type: str 102 sample: https://www.powershellgallery.com/api/v2/package/ 103 registered: 104 description: 105 - Whether the module is registered. Should always be C(True) 106 type: bool 107''' 108