mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
6b294eab4d
* win_dsc - Add argument validation and other fixes * Fix doc issues
39 lines
1,020 B
YAML
39 lines
1,020 B
YAML
---
|
|
- name: get powershell version
|
|
win_shell: $PSVersionTable.PSVersion.Major
|
|
register: powershell_version
|
|
|
|
- name: expect failure when running on old PS hosts
|
|
win_dsc:
|
|
resource_name: File
|
|
register: fail_dsc_old
|
|
failed_when: '"This module cannot run as it requires a minimum PowerShell version of 5.0" not in fail_dsc_old.msg'
|
|
when: powershell_version.stdout_lines[0]|int < 5
|
|
|
|
- name: run tests when PSv5+
|
|
when: powershell_version.stdout_lines[0]|int >= 5
|
|
block:
|
|
- name: add remote temp dir to PSModulePath
|
|
win_path:
|
|
name: PSModulePath
|
|
state: present
|
|
scope: machine
|
|
elements:
|
|
- '{{ remote_tmp_dir }}'
|
|
|
|
- name: copy custom DSC resources to remote temp dir
|
|
win_copy:
|
|
src: xTestDsc
|
|
dest: '{{ remote_tmp_dir }}'
|
|
|
|
- name: run tests
|
|
include_tasks: tests.yml
|
|
|
|
always:
|
|
- name: remove remote tmp dir from PSModulePath
|
|
win_path:
|
|
name: PSModulePath
|
|
state: absent
|
|
scope: machine
|
|
elements:
|
|
- '{{ remote_tmp_dir }}'
|