Debian Codegraph @

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

raw
1 ---
2 - name: create test folder(s)
3 ansible.windows.win_file:
4 path: '{{test_win_pester_path}}\{{item}}'
5 state: directory
6 with_items:
7 - Modules
8 - Tests
9
10 - name: download Pester module from S3 bucket
11 ansible.windows.win_get_url:
12 # this was downloaded straight off the Pester GitHub release page and uploaded to the S3 bucket
13 # https://github.com/pester/Pester/releases
14 url: 'https://ansible-ci-files.s3.amazonaws.com/test/integration/roles/test_win_pester/Pester-4.3.1.zip'
15 dest: '{{test_win_pester_path}}\Pester-4.3.1.zip'
16 register: download_res
17 until: download_res is successful
18 retries: 3
19 delay: 5
20
21 - name: unzip Pester module
22 win_unzip:
23 src: '{{test_win_pester_path}}\Pester-4.3.1.zip'
24 dest: '{{test_win_pester_path}}\Modules'
25
26 - name: rename extracted zip to match module name
27 ansible.windows.win_shell: Rename-Item -Path '{{test_win_pester_path}}\Modules\Pester-4.3.1' -NewName Pester
28
29 - name: add custom Pester location to the PSModulePath
30 ansible.windows.win_path:
31 name: PSModulePath
32 scope: machine
33 state: present
34 elements:
35 - '{{test_win_pester_path}}\Modules'
36
37 - meta: reset_connection
38
39 - name: copy test files
40 ansible.windows.win_copy:
41 src: files/
42 dest: '{{test_win_pester_path}}\Tests'
43
44 - block:
45 - name: run Pester tests
46 include_tasks: test.yml
47 vars:
48 test_path: '{{ test_win_pester_path }}\Tests'
49
50 always:
51 - name: remove custom pester location on the PSModulePath
52 ansible.windows.win_path:
53 name: PSModulePath
54 scope: machine
55 state: absent
56 elements:
57 - '{{test_win_pester_path}}\Modules'
58
59 - meta: reset_connection
60
61 - name: delete test folder
62 ansible.windows.win_file:
63 path: '{{test_win_pester_path}}'
64 state: absent