community.windows.win_psrepository_info (2.2.0) — module

Gather information about PSRepositories

Authors: Brian Scholer (@briantist)

Install collection

Install with ansible-galaxy collection install community.windows:==2.2.0


Add to requirements.yml

  collections:
    - name: community.windows
      version: 2.2.0

Description

Gather information about all or a specific PSRepository.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get info for a single repository
  community.windows.win_psrepository_info:
    name: PSGallery
  register: repo_info
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Find all repositories that start with 'MyCompany'
  community.windows.win_psrepository_info:
    name: MyCompany*
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get info for all repositories
  community.windows.win_psrepository_info:
  register: repo_info
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove all repositories that don't have a publish_location set
  community.windows.win_psrepository:
    name: "{{ item }}"
    state: absent
  loop: "{{ repo_info.repositories | rejectattr('publish_location', 'none') | list }}"

Inputs

    
name:
    default: '*'
    description:
    - The name of the repository to retrieve.
    - Supports any wildcard pattern supported by C(Get-PSRepository).
    - If omitted then all repositories will returned.
    type: str

Outputs

repositories:
  contains:
    installation_policy:
      description:
      - The installation policy of the repository. The sample values are the only
        possible values.
      sample:
      - Trusted
      - Untrusted
      type: str
    name:
      description:
      - The name of the repository.
      sample: PSGallery
      type: str
    package_management_provider:
      description:
      - The name of the package management provider for this repository.
      sample: NuGet
      type: str
    provider_options:
      description:
      - Provider-specific options for this repository.
      type: dict
    publish_location:
      description:
      - The location used to publish modules.
      sample: https://www.powershellgallery.com/api/v2/package/
      type: str
    registered:
      description:
      - Whether the module is registered. Should always be C(True)
      type: bool
    script_publish_location:
      description:
      - The location used to publish scripts.
      sample: https://www.powershellgallery.com/api/v2/package/
      type: str
    script_source_location:
      description:
      - The location used to find and retrieve scripts.
      sample: https://www.powershellgallery.com/api/v2/items/psscript
      type: str
    source_location:
      description:
      - The location used to find and retrieve modules. This should always have a
        value.
      sample: https://www.powershellgallery.com/api/v2
      type: str
    trusted:
      description:
      - A boolean flag reflecting the value of C(installation_policy) as to whether
        the repository is trusted.
      type: bool
  description:
  - A list of repositories (or an empty list is there are none).
  elements: dict
  returned: always
  type: list

See also