Debian Codegraph @

ansible_collections/community/windows/tests/integration/targets/win_psmodule_info/tasks/main.yml

raw
1 # This file is part of Ansible
2
3 # Copyright: (c) 2020, Brian Scholer <@briantist>
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5 ---
6 - name: Reset repositories
7 ansible.windows.win_shell: |
8 if (-not (Get-PackageProvider -ListAvailable | Where-Object { ($_.name -eq 'Nuget') -and ($_.version -ge "2.8.5.201") }) ) {
9 Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
10 }
11 Get-PSRepository | Unregister-PSRepository
12 Register-PSRepository -Default
13
14 - name: Create the repository directory
15 ansible.windows.win_file:
16 path: '{{ repo_path }}'
17 state: directory
18
19 - name: Download required nupkgs
20 ansible.windows.win_get_url:
21 url: '{{ item.url }}'
22 dest: '{{ repo_path }}\{{ item.name }}.nupkg'
23 register: download_res
24 until: download_res is successful
25 retries: 3
26 delay: 5
27 loop:
28 - name: ansiblevault
29 url: https://ansible-ci-files.s3.us-east-1.amazonaws.com/test/integration/targets/win_psmodule_info/ansiblevault.0.3.0.nupkg
30 - name: pinvokehelper
31 url: https://ansible-ci-files.s3.us-east-1.amazonaws.com/test/integration/targets/win_psmodule_info/pinvokehelper.0.1.0.nupkg
32 - name: pscsharpinvoker
33 url: https://ansible-ci-files.s3.us-east-1.amazonaws.com/test/integration/targets/win_psmodule_info/pscsharpinvoker.0.1.0.nupkg
34
35 - name: Register repository
36 community.windows.win_psrepository:
37 name: "{{ repository_name }}"
38 source_location: "{{ repo_path }}"
39 installation_policy: trusted
40
41 - block:
42 - name: Install Modules
43 community.windows.win_psmodule:
44 name: "{{ item }}"
45 state: latest
46 repository: "{{ repository_name }}"
47 loop: "{{ modules_to_install }}"
48
49 - name: Run Tests
50 import_tasks: tests.yml
51
52 - name: Run Tests (check mode)
53 import_tasks: tests.yml
54 vars:
55 run_check_mode: True
56
57 always:
58 - name: Remove Modules
59 community.windows.win_psmodule:
60 name: "{{ item }}"
61 state: absent
62 loop: "{{ modules_to_install }}"
63
64 - name: Reset repositories
65 ansible.windows.win_shell: |
66 Get-PSRepository | Unregister-PSRepository
67 Register-PSRepository -Default