Remove Windows Server 2016 support (#86852)

* ansible-test - Remove Windows Server 2016 remote
* Drop Windows Server 2016 support from psrp connection plugin
* Remove test support for EOL Windows versions
* Tighten up win_script integration test
* Remove obsolete Windows version check from test
This commit is contained in:
Matt Clay
2026-04-16 02:42:17 +00:00
committed by GitHub
parent a5a9fbd9ec
commit bd7fa60c24
8 changed files with 11 additions and 52 deletions
-4
View File
@@ -69,8 +69,6 @@ stages:
nameFormat: Server {0}
testFormat: windows/{0}/1
targets:
- name: 2016 WinRM HTTP WinPS
test: 2016/winrm/http/5.1
- name: 2019 WinRM HTTPS WinPS
test: 2019/winrm/https/5.1
- name: 2022 WinRM HTTPS WinPS
@@ -234,8 +232,6 @@ stages:
nameFormat: Server {0}
testFormat: i/windows/{0}
targets:
- name: 2016 WinRM HTTP WinPS
test: 2016/winrm/http/5.1
- name: 2019 WinRM HTTPS WinPS
test: 2019/winrm/https/5.1
- name: 2022 WinRM HTTPS WinPS
@@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Remove support for Windows Server 2016 managed remote.
+2
View File
@@ -0,0 +1,2 @@
minor_changes:
- psrp connection plugin - Remove explicit error handling support for Windows Server 2016.
+1 -11
View File
@@ -746,17 +746,7 @@ class Connection(ConnectionBase):
# NativeCommandError and NativeCommandErrorMessage are special
# cases used for stderr from a subprocess, we will just print the
# error message
if error.fq_error == 'NativeCommandErrorMessage' and not error.target_name:
# This can be removed once Server 2016 is EOL and no longer
# supported. PS 5.1 on 2016 will emit 1 error record under
# NativeCommandError being the first line, subsequent records
# are the raw stderr up to 4096 chars. Each entry is the raw
# stderr value without any newlines appended so we just use the
# value as is. We know it's 2016 as the target_name is empty in
# this scenario.
stderr_list.append(str(error))
continue
elif error.fq_error in ['NativeCommandError', 'NativeCommandErrorMessage']:
if error.fq_error in ['NativeCommandError', 'NativeCommandErrorMessage']:
stderr_list.append(f"{error}\r\n")
continue
@@ -2045,33 +2045,10 @@ test_no_log - Invoked with:
$output = [Ansible.Basic.AnsibleModule]::FromJson($_.Exception.InnerException.Output)
}
if ([System.Environment]::OSVersion.Version -lt [Version]'10.0') {
# Older hosts can only do delete on close. This means Dir1 and its
# file will still be present but Dir2 should be deleted.
$expected_msg = "Failure cleaning temp path '$actual_tmpdir': IOException Directory contains files still open by other processes"
$output.warnings.Count | Assert-Equal -Expected 1
$output.warnings[0] | Assert-Equal -Expected $expected_msg
(Test-Path -LiteralPath $actual_tmpdir -PathType Container) | Assert-Equal -Expected $false
$output.warnings.Count | Assert-Equal -Expected 0
(Test-Path -LiteralPath $actual_tmpdir -PathType Container) | Assert-Equal -Expected $true
(Test-Path -LiteralPath $dir1 -PathType Container) | Assert-Equal -Expected $true
# Test-Path tries to open the file in a way that fails if it's marked as deleted
(Get-ChildItem -LiteralPath $dir1 -File).Count | Assert-Equal -Expected 1
(Test-Path -LiteralPath $dir2 -PathType Container) | Assert-Equal -Expected $false
(Test-Path -LiteralPath $file3 -PathType Leaf) | Assert-Equal -Expected $false
# Releasing the file handle releases the lock on the file deleting
# it. Unfortunately the parent dir will still be present
$fs.Dispose()
(Test-Path -LiteralPath $dir1 -PathType Container) | Assert-Equal -Expected $true
(Test-Path -LiteralPath $file1 -PathType Leaf) | Assert-Equal -Expected $false
}
else {
# Server 2016+ can use the POSIX APIs which will delete it straight away
(Test-Path -LiteralPath $actual_tmpdir -PathType Container) | Assert-Equal -Expected $false
$output.warnings.Count | Assert-Equal -Expected 0
$fs.Dispose()
}
$fs.Dispose()
Remove-Item -LiteralPath $remote_tmp -Force -Recurse
}
@@ -20,14 +20,7 @@
- ansible_install_dir is defined
- local_tmp_dir is defined
- name: get OS version
ansible.windows.win_powershell:
script: (Get-Item -LiteralPath $env:SystemRoot\System32\kernel32.dll).VersionInfo.ProductVersion.ToString()
register: os_version
- name: setup and test block for 2019 and later
when:
- os_version.output[0] is version('10.0.17763', '>=') # 2019+
- name: setup and test block
block:
- name: get test remote tmp dir
import_role:
@@ -335,9 +335,9 @@
that:
- script_stderr.rc == 0
- script_stderr.stdout == ""
# SSH includes debug output in stderr, and WinRM on 2016 includes a trailing newline
# SSH includes debug output in stderr and includes a trailing newline
# Use a simple search to ensure the expected stderr is present but ignoring any extra output
- script_stderr.stderr is search("stderr 1\r\nstderr 2\r\n")
- script_stderr.stderr == "stderr 1\r\nstderr 2\r\n"
- name: run script with non-ASCII contents
script: test_script_unicode.ps1
@@ -1,4 +1,3 @@
windows/2016 provider=aws arch=x86_64 connection=winrm+http
windows/2019 provider=aws arch=x86_64 connection=winrm+https
windows/2022 provider=aws arch=x86_64 connection=winrm+https
windows/2025 provider=aws arch=x86_64 connection=psrp+http alias=windows/latest