mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1020 B
YAML
40 lines
1020 B
YAML
5 years ago
|
---
|
||
|
- 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 }}'
|