Debian Codegraph @

test/integration/targets/powershell-windows-target/tasks/main.yml

raw
1 - name: Find powershell location
2 win_shell: (Get-Command powershell).source
3 register: powershell_location
4
5 - name: Get powershell version
6 win_command: |
7 "{{ powershell_location.stdout | trim }}" -Command "$PSVersionTable.PSVersion.ToString()"
8 register: powershell_version
9
10 - name: Show powershell location and version
11 debug:
12 msg: "{{ powershell_location.stdout | trim }} is {{ powershell_version.stdout | trim }}"
13
14 - when: ansible_pwsh_interpreter is defined
15 block:
16 - name: Get ansible_pwsh_interpreter version
17 win_command: |
18 "{{ ansible_pwsh_interpreter }}" -Command "$PSVersionTable.PSVersion.ToString()"
19 register: ansible_pwsh_interpreter_version
20
21 - name: Show ansible_pwsh_interpreter location and version
22 debug:
23 msg: "{{ ansible_pwsh_interpreter }} is {{ ansible_pwsh_interpreter_version.stdout | trim }}"