win_rds: move the tests into 1 target to make it quicker (#51728)

This commit is contained in:
Jordan Borean 2019-02-06 05:28:49 +10:00 committed by GitHub
parent 64084d593e
commit e284d21139
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 77 additions and 86 deletions

View file

@ -1,29 +0,0 @@
---
# Server 2008 R2 requires us to remove this first before the other features
- name: remove the RDS-Gateway feature
win_feature:
name: RDS-Gateway
state: absent
listen: remove RDS feature
register: rds_uninstall
- name: reboot after removing RDS-Gateway feature
win_reboot:
when: rds_uninstall.reboot_required
listen: remove RDS feature
# Now remove the remaining features
- name: remove installed RDS feature
win_feature:
name:
- RDS-Licensing
- RDS-RD-Server
- Web-Server # not part of the initial feature install but RDS-Gateway requires this and it breaks httptester
state: absent
listen: remove RDS feature
register: rds_uninstall2
- name: reboot after feature removal
win_reboot:
when: rds_uninstall2.reboot_required
listen: remove RDS feature

View file

@ -1,29 +0,0 @@
---
# Cannot use win_feature to install RDS on Server 2008
- name: check if feature is availble
win_shell: if (Get-Command -Name Add-WindowsFeature -ErrorAction SilentlyContinue) { $true } else { $false }
changed_when: False
register: module_available
- name: set fact when RDS is available
set_fact:
rds_available: '{{ module_available.stdout | trim | bool }}'
- name: install Remote Desktop Gateway features
when: rds_available
block:
- name: ensure Remote Desktop Gateway services are installed
win_feature:
name:
- RDS-Gateway
- RDS-Licensing
- RDS-RD-Server
state: present
register: rds_install
notify:
- remove RDS feature
- name: reboot server if needed
win_reboot:
post_reboot_delay: 10
when: rds_install.reboot_required

View file

@ -0,0 +1,6 @@
shippable/windows/group3
destructive
skip/windows/2008 # win_feature is required to install the RDS feature and that doesn't support 2008
win_rds_cap
win_rds_rap
win_rds_settings

View file

@ -0,0 +1,9 @@
# win_rds_cap
test_win_rds_cap_name: Ansible Test CAP
# win_rds_rap
test_win_rds_rap_name: Ansible Test RAP
# win_rds_settings
test_win_rds_settings_path: '{{win_output_dir}}\win_rds_settings'
rds_cert_suject: rdg.test.com

View file

@ -0,0 +1,58 @@
---
# Cannot use win_feature to install RDS on Server 2008
- name: check if feature is availble
win_shell: if (Get-Command -Name Add-WindowsFeature -ErrorAction SilentlyContinue) { $true } else { $false }
changed_when: False
register: module_available
- name: install Remote Desktop Gateway features
when: module_available.stdout | trim | bool
block:
- name: ensure Remote Desktop Gateway services are installed
win_feature:
name:
- RDS-Gateway
- RDS-Licensing
- RDS-RD-Server
state: present
register: rds_install
- name: reboot server if needed
win_reboot:
post_reboot_delay: 10
when: rds_install.reboot_required
- name: run win_rds_cap integration tests
include_tasks: win_rds_cap.yml
- name: run win_rds_rap integration tests
include_tasks: win_rds_rap.yml
- name: run win_rds_settings integration tests
include_tasks: win_rds_settings.yml
always:
# Server 2008 R2 requires us to remove this first before the other features
- name: remove the RDS-Gateway feature
win_feature:
name: RDS-Gateway
state: absent
register: rds_uninstall
- name: reboot after removing RDS-Gateway feature
win_reboot:
when: rds_uninstall.reboot_required
# Now remove the remaining features
- name: remove installed RDS feature
win_feature:
name:
- RDS-Licensing
- RDS-RD-Server
- Web-Server # not part of the initial feature install but RDS-Gateway requires this and it breaks httptester
state: absent
register: rds_uninstall2
- name: reboot after feature removal
win_reboot:
when: rds_uninstall2.reboot_required

View file

@ -1,9 +1,8 @@
--- ---
- name: run tests with cleanup - name: run tests with cleanup
when: rds_available # defined in setup_win_rds
block: block:
- name: run tests - name: run tests
include_tasks: tests.yml include_tasks: win_rds_cap_tests.yml
always: always:
- name: delete all CAPs - name: delete all CAPs

View file

@ -1,9 +1,8 @@
--- ---
- name: run tests with cleanup - name: run tests with cleanup
when: rds_available # defined in setup_win_rds
block: block:
- name: run tests - name: run tests
include_tasks: tests.yml include_tasks: win_rds_rap_tests.yml
always: always:
- name: delete all RAPs - name: delete all RAPs

View file

@ -1,6 +1,4 @@
---
- name: run tests with cleanup - name: run tests with cleanup
when: rds_available # defined in setup_win_rds
block: block:
- name: gather facts - name: gather facts
setup: setup:
@ -46,8 +44,8 @@
raw: '(gci Cert:\LocalMachine\my | ? {$_.subject -eq "CN={{ rds_cert_suject }}"})[0].Thumbprint' raw: '(gci Cert:\LocalMachine\my | ? {$_.subject -eq "CN={{ rds_cert_suject }}"})[0].Thumbprint'
register: rds_cert_thumbprint register: rds_cert_thumbprint
# - name: run tests - name: run tests
# include_tasks: tests.yml include_tasks: win_rds_settings_tests.yml
always: always:
- name: restore RDS base configuration - name: restore RDS base configuration

View file

@ -1,3 +0,0 @@
shippable/windows/group3
destructive
skip/windows/2008 # win_feature is requires to install the RDS feature and that doesn't support 2008

View file

@ -1 +0,0 @@
test_win_rds_cap_name: Ansible Test CAP

View file

@ -1,3 +0,0 @@
---
dependencies:
- setup_win_rds

View file

@ -1,3 +0,0 @@
shippable/windows/group3
destructive
skip/windows/2008 # win_feature is requires to install the RDS feature and that doesn't support 2008

View file

@ -1 +0,0 @@
test_win_rds_rap_name: Ansible Test RAP

View file

@ -1,2 +0,0 @@
dependencies:
- setup_win_rds

View file

@ -1,3 +0,0 @@
shippable/windows/group1
destructive
skip/windows/2008 # win_feature is requires to install the RDS feature and that doesn't support 2008

View file

@ -1,2 +0,0 @@
test_win_rds_settings_path: '{{win_output_dir}}\win_rds_settings'
rds_cert_suject: rdg.test.com

View file

@ -1,2 +0,0 @@
dependencies:
- setup_win_rds