1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/win_rds_settings/tasks/tests.yml
Kevin Subileau 5d15a539c7 Add modules to manage Remote Desktop Services (#43406)
* Add windows module win_rds_settings

* Add windows module win_rds_rap

* Add windows module win_rds_cap

* Add tests for module win_rds_settings

* Add tests for module win_rds_rap

* Add tests for module win_rds_cap

* Validate user and computer groups in module win_rds_cap

* Validate user groups in module win_rds_rap

* Support additional formats (UPN, Down-Level Login Name, SID and Login Name) for user and computer group names in module win_rds_cap

* Support additional formats (UPN, Down-Level Login Name, SID and Login Name) for user group names in module win_rds_rap

* Validate computer group parameter and support additional formats (UPN, Down-Level Login Name, SID and Login Name) in module win_rds_rap

* Validate allowed ports parameter in module win_rds_rap

* Ensure user group list is not empty in module win_rds_rap

* Remove unwanted value in result object

* Ensure user group list is not empty in module win_rds_cap

* Ensure order parameter value never exceed the number of existing CAPs in module win_rds_cap

* Add diff mode support to win_rds_cap

* Add diff mode support to win_rds_rap

* Add diff mode support to win_rds_settings

* Add SSL bridging and messaging policy settings to module win_rds_settings

* Fix copyright

[skip ci]

* Add missing trailing dots in documentation

[skip ci]

* Fix incorrect variable passed to Fail-Json

* Minor changes and doc update

* Avoid using Powershell aliases

* Use WMI instead of PSProvider to handle group names to avoid conversion in UPN form

* Use CIM instead of WMI cmdlets
2019-01-30 07:21:56 +10:00

89 lines
No EOL
3.2 KiB
YAML

---
- name: test change RDS settings (check mode)
win_rds_settings:
max_connections: 50
certificate_hash: '{{rds_cert_thumbprint.stdout_lines[0]}}'
ssl_bridging: https_https
enable_only_messaging_capable_clients: yes
register: configure_rds_check
check_mode: yes
- name: get result of change RDS settings (check mode)
win_shell: |
Import-Module RemoteDesktopServices
(Get-Item RDS:\GatewayServer\MaxConnections).CurrentValue
(Get-Item RDS:\GatewayServer\SSLCertificate\Thumbprint).CurrentValue
(Get-Item RDS:\GatewayServer\SSLBridging).CurrentValue
(Get-Item RDS:\GatewayServer\EnableOnlyMessagingCapableClients).CurrentValue
register: configure_rds_actual_check
- name: assert results of change RDS settings (check mode)
assert:
that:
- configure_rds_check.changed == true
- configure_rds_actual_check.stdout_lines[0] != "50"
- configure_rds_actual_check.stdout_lines[1] != rds_cert_thumbprint.stdout_lines[0]
- configure_rds_actual_check.stdout_lines[2] == "0"
- configure_rds_actual_check.stdout_lines[3] == "0"
- name: test change RDS settings
win_rds_settings:
max_connections: 50
certificate_hash: '{{rds_cert_thumbprint.stdout_lines[0]}}'
ssl_bridging: https_https
enable_only_messaging_capable_clients: yes
register: configure_rds
- name: get result of change RDS settings
win_shell: |
Import-Module RemoteDesktopServices
(Get-Item RDS:\GatewayServer\MaxConnections).CurrentValue
(Get-Item RDS:\GatewayServer\SSLCertificate\Thumbprint).CurrentValue
(Get-Item RDS:\GatewayServer\SSLBridging).CurrentValue
(Get-Item RDS:\GatewayServer\EnableOnlyMessagingCapableClients).CurrentValue
register: configure_rds_actual
- name: assert results of change RDS settings
assert:
that:
- configure_rds.changed == true
- configure_rds_actual.stdout_lines[0] == "50"
- configure_rds_actual.stdout_lines[1] == rds_cert_thumbprint.stdout_lines[0]
- configure_rds_actual.stdout_lines[2] == "2"
- configure_rds_actual.stdout_lines[3] == "1"
- name: test change RDS settings (idempotent)
win_rds_settings:
max_connections: 50
certificate_hash: '{{rds_cert_thumbprint.stdout_lines[0]}}'
ssl_bridging: https_https
enable_only_messaging_capable_clients: yes
register: configure_rds_again
- name: assert results of change RDS settings (idempotent)
assert:
that:
- configure_rds_again.changed == false
- name: test disable connection limit
win_rds_settings:
max_connections: -1
register: disable_limit
- name: get result of disable connection limit
win_shell: |
Import-Module RemoteDesktopServices
(Get-Item RDS:\GatewayServer\MaxConnections).CurrentValue -eq (Get-Item RDS:\GatewayServer\MaxConnectionsAllowed).CurrentValue
register: disable_limit_actual
- name: assert results of disable connection limit
assert:
that:
- disable_limit.changed == true
- disable_limit_actual.stdout_lines[0] == "True"
- name: fail with invalid certificate thumbprint
win_rds_settings:
certificate_hash: 72E8BD0216FA14100192A3E8B7B150C65B4B0817
register: fail_invalid_cert
failed_when: fail_invalid_cert.msg is not search('Unable to locate certificate')