--- # Cannot use win_feature to install RDS on Server 2008. # Run a brief check and skip hosts that don't support # that operation - 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: 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: - name: delete all RAPs win_shell: Import-Module RemoteDesktopServices; Remove-Item -Path RDS:\GatewayServer\RAP\* -Recurse when: module_available.rc == 0