ansible/test/integration/targets/incidental_win_dsc/tasks/main.yml
Matt Clay f735fd672a
Third batch of incidental integration tests. (#67830)
* Copy in incidental windows tests.

* Update incidental test aliases.

* Add support plugins.

* Update target references.

* Update sanity ignores.

* Update integration-aliases test.

* Add to CI.
2020-02-27 16:05:47 -08: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 }}'