ansible/test/integration/targets/win_dsc/tasks/main.yml
Jordan Borean 6b294eab4d
win_dsc - Add argument validation and other fixes (#53093)
* win_dsc - Add argument validation and other fixes

* Fix doc issues
2019-03-06 06:49:37 +10:00

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 }}'