Note
This plugin is part of the community.windows collection (version 1.7.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.windows.
To use it in a playbook, specify: community.windows.win_psrepository_copy.
New in version 1.3.0: of community.windows
Default profile so that new users start with the selected repositories.| Parameter | Choices/Defaults | Comments |
|---|---|---|
| exclude list / elements=string | The names of repositories to exclude. Names are interpreted as wildcards. If a name matches both an include (name) and exclude, it will be excluded. | |
| exclude_profiles list / elements=string | Default: ["systemprofile", "LocalService", "NetworkService"] | The names of user profiles to exclude. If a profile matches both an include (profiles) and exclude_profiles, it will be excluded. By default, the service account profiles are excluded. To explcitly exclude nothing, set exclude_profiles=[]. |
| name list / elements=string | Default: ["*"] | The names of repositories to copy. Names are interpreted as wildcards. |
| profiles list / elements=string | Default: ["*"] | The names of user profiles to populate with repositories. Names are interpreted as wildcards. The Default profile can also be matched.The Public and All Users profiles cannot be targeted, as PSRepositories are not loaded from them. |
| source path | Default: "%LOCALAPPDATA%\\Microsoft\\Windows\\PowerShell\\PowerShellGet\\PSRepositories.xml" | The full path to the source repositories XML file. Defaults to the repositories registered to the current user. |
Note
PowerShellGet module or any other external dependencies.become=yes. See examples.PSGallery, however if this module creates a new repos file and your selected repositories don’t include PSGallery, it won’t be in your destination.JoeUser.Contoso vs. JoeUser. If you intend to filter user profiles, ensure your filters catch the right names.systemprofile (for the SYSTEM user), and LocalService or NetworkService for those accounts respectively.See also
The official documentation on the community.windows.win_psrepository module.
The official documentation on the community.windows.win_psrepository_info module.
- name: Copy the current user's PSRepositories to all non-service account profiles and Default profile
community.windows.win_psrepository_copy:
- name: Copy the current user's PSRepositories to all profiles and Default profile
community.windows.win_psrepository_copy:
exclude_profiles: []
- name: Copy the current user's PSRepositories to all profiles beginning with A, B, or C
community.windows.win_psrepository_copy:
profiles:
- 'A*'
- 'B*'
- 'C*'
- name: Copy the current user's PSRepositories to all profiles beginning B except Brian and Brianna
community.windows.win_psrepository_copy:
profiles: 'B*'
exclude_profiles:
- Brian
- Brianna
- name: Copy a specific set of repositories to profiles beginning with 'svc' with exceptions
community.windows.win_psrepository_copy:
name:
- CompanyRepo1
- CompanyRepo2
- PSGallery
profiles: 'svc*'
exclude_profiles: 'svc-restricted'
- name: Copy repos matching a pattern with exceptions
community.windows.win_psrepository_copy:
name: 'CompanyRepo*'
exclude: 'CompanyRepo*-Beta'
- name: Copy repositories from a custom XML file on the target host
community.windows.win_psrepository_copy:
source: 'C:\data\CustomRepostories.xml'
### A sample workflow of seeding a system with a custom repository
# A playbook that does initial host setup or builds system images
- name: Register custom respository
community.windows.win_psrepository:
name: PrivateRepo
source_location: https://example.com/nuget/feed/etc
installation_policy: trusted
- name: Ensure all current and new users have this repository registered
community.windows.win_psrepository_copy:
name: PrivateRepo
# In another playbook, run by other users (who may have been created later)
- name: Install a module
community.windows.win_psmodule:
name: CompanyModule
repository: PrivateRepo
state: present
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/windows/win_psrepository_copy_module.html