1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ansible-test: fix incompatibilty with the RDS tests and httptester (#51716)

* test out win_uri on Shippable

* run all tests for group 3 - ci_complete

* use shared setup and cleanup role for RDS

* Set shippable matrix back to normal

* cleanup changes to support Server 2008 R2
This commit is contained in:
Jordan Borean 2019-02-05 16:03:12 +10:00 committed by GitHub
parent d5797aa02f
commit c572d17c2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 102 additions and 94 deletions

View file

@ -0,0 +1,29 @@
---
# 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

@ -0,0 +1,29 @@
---
# 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

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

View file

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

View file

@ -1,30 +1,10 @@
--- ---
# Cannot use win_feature to install RDS on Server 2008. - name: run tests with cleanup
# Run a brief check and skip hosts that don't support when: rds_available # defined in setup_win_rds
# that operation block:
- name: check if win_feature will work on test host - name: run tests
win_command: powershell.exe "exit (-not (Get-Command -Name Add-WindowsFeature -ErrorAction SilentlyContinue))" include_tasks: tests.yml
register: module_available
failed_when: False
# Run actual tests
- block:
- name: ensure Remote Desktop Gateway services are installed
win_feature:
name: RDS-Gateway,RDS-Licensing,RDS-RD-Server
state: present
include_management_tools: True
register: rds_install
- name: reboot server if needed
win_reboot:
post_reboot_delay: 10
when: rds_install.reboot_required
- include_tasks: tests.yml
always: always:
- name: delete all CAPs - name: delete all CAPs
win_shell: Import-Module RemoteDesktopServices; Remove-Item -Path RDS:\GatewayServer\CAP\* -Recurse win_shell: Import-Module RemoteDesktopServices; Remove-Item -Path RDS:\GatewayServer\CAP\* -Recurse
when: module_available.rc == 0

View file

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

View file

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

View file

@ -1,30 +1,10 @@
--- ---
# Cannot use win_feature to install RDS on Server 2008. - name: run tests with cleanup
# Run a brief check and skip hosts that don't support when: rds_available # defined in setup_win_rds
# that operation block:
- name: check if win_feature will work on test host - name: run tests
win_command: powershell.exe "exit (-not (Get-Command -Name Add-WindowsFeature -ErrorAction SilentlyContinue))" include_tasks: tests.yml
register: module_available
failed_when: False
# Run actual tests
- block:
- name: ensure Remote Desktop Gateway services are installed
win_feature:
name: RDS-Gateway,RDS-Licensing,RDS-RD-Server
state: present
include_management_tools: True
register: rds_install
- name: reboot server if needed
win_reboot:
post_reboot_delay: 10
when: rds_install.reboot_required
- include_tasks: tests.yml
always: always:
- name: delete all RAPs - name: delete all RAPs
win_shell: Import-Module RemoteDesktopServices; Remove-Item -Path RDS:\GatewayServer\RAP\* -Recurse win_shell: Import-Module RemoteDesktopServices; Remove-Item -Path RDS:\GatewayServer\RAP\* -Recurse
when: module_available.rc == 0

View file

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

View file

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

View file

@ -1,30 +1,11 @@
--- ---
# Cannot use win_feature to install RDS on Server 2008. - name: run tests with cleanup
# Run a brief check and skip hosts that don't support when: rds_available # defined in setup_win_rds
# that operation block:
- name: check if win_feature will work on test host
win_command: powershell.exe "exit (-not (Get-Command -Name Add-WindowsFeature -ErrorAction SilentlyContinue))"
register: module_available
failed_when: False
# Run actual tests
- block:
- name: gather facts - name: gather facts
setup: setup:
filter: ansible_hostname filter: ansible_hostname
- name: ensure Remote Desktop Gateway services are installed
win_feature:
name: RDS-Gateway,RDS-Licensing,RDS-RD-Server
state: present
include_management_tools: True
register: rds_install
- name: reboot server if needed
win_reboot:
post_reboot_delay: 10
when: rds_install.reboot_required
- name: ensure testing folders exists - name: ensure testing folders exists
win_file: win_file:
path: '{{test_win_rds_settings_path}}' path: '{{test_win_rds_settings_path}}'
@ -65,7 +46,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
- include_tasks: tests.yml # - name: run tests
# include_tasks: tests.yml
always: always:
- name: restore RDS base configuration - name: restore RDS base configuration
@ -84,5 +66,3 @@
win_file: win_file:
path: '{{test_win_rds_settings_path}}' path: '{{test_win_rds_settings_path}}'
state: absent state: absent
when: module_available.rc == 0