From: Alex Willmer <alex@moreati.org.uk>
Date: Mon, 4 Nov 2024 22:43:48 +0000
Subject: Support Ansible 11 (ansible-core 2.18)

Bug-Debian: https://bugs.debian.org/1087929
Bug-Upstream: https://github.com/mitogen-hq/mitogen/issues/1129
Origin: https://github.com/mitogen-hq/mitogen/pull/1177/commits/2f301ef700fae6396a9ee836a84e9c2c478b0503
---
 .github/workflows/tests.yml | 15 +++++++++------
 ansible_mitogen/loaders.py  |  2 +-
 docs/ansible_detailed.rst   |  2 ++
 docs/changelog.rst          |  1 +
 tox.ini                     | 12 ++++++++----
 5 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 15dda03..374ff4f 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -63,9 +63,12 @@ jobs:
           - name: Ans_313_10
             python_version: '3.13'
             tox_env: py313-mode_ansible-ansible10
-          - name: Van_313_10
+          - name: Ans_313_11
             python_version: '3.13'
-            tox_env: py313-mode_ansible-ansible10-strategy_linear
+            tox_env: py313-mode_ansible-ansible11
+          - name: Van_313_11
+            python_version: '3.13'
+            tox_env: py313-mode_ansible-ansible11-strategy_linear
 
           - name: Mito_27
             tox_env: py27-mode_mitogen
@@ -167,11 +170,11 @@ jobs:
           - name: Mito_313
             tox_env: py313-mode_mitogen
 
-          - name: Loc_313_10
-            tox_env: py313-mode_localhost-ansible10
+          - name: Loc_313_11
+            tox_env: py313-mode_localhost-ansible11
 
-          - name: Van_313_10
-            tox_env: py313-mode_localhost-ansible10-strategy_linear
+          - name: Van_313_11
+            tox_env: py313-mode_localhost-ansible11-strategy_linear
 
     steps:
       - uses: actions/checkout@v4
diff --git a/ansible_mitogen/loaders.py b/ansible_mitogen/loaders.py
index 9d9876a..632b11b 100644
--- a/ansible_mitogen/loaders.py
+++ b/ansible_mitogen/loaders.py
@@ -49,7 +49,7 @@ __all__ = [
 
 
 ANSIBLE_VERSION_MIN = (2, 10)
-ANSIBLE_VERSION_MAX = (2, 17)
+ANSIBLE_VERSION_MAX = (2, 18)
 
 NEW_VERSION_MSG = (
     "Your Ansible version (%s) is too recent. The most recent version\n"
diff --git a/docs/ansible_detailed.rst b/docs/ansible_detailed.rst
index 73ebba4..3d80a29 100644
--- a/docs/ansible_detailed.rst
+++ b/docs/ansible_detailed.rst
@@ -141,6 +141,8 @@ Noteworthy Differences
   +-----------------+ 3.10 - 3.13     |
   | 10              |                 |
   +-----------------+-----------------+
+  | 11              | 3.11 - 3.13     |
+  +-----------------+-----------------+
 
   Verify your installation is running one of these versions by checking
   ``ansible --version`` output.
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 93e3a45..300e7e3 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -17,6 +17,7 @@ Release Notes
 To avail of fixes in an unreleased version, please download a ZIP file
 `directly from GitHub <https://github.com/mitogen-hq/mitogen/>`_.
 
+* :gh:issue:`1129` :mod:`ansible_mitogen`: Ansible 11 support
 
 v0.3.18 (2024-11-07)
 --------------------
diff --git a/tox.ini b/tox.ini
index 5afa7eb..8c6569e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -12,10 +12,10 @@
 # 2.7  <= 2.11    <= 2.16    <= 5.5     <= 1.11.29 <= 2.11.3  <= 20                 <= 4.6.11  <= 3.28    <= 20.15²
 # 3.5  <= 2.11    <= 2.15    <= 5.5     <= 2.2.28  <= 2.11.3  <= 20      <= 5.9.5   <= 6.1.0   <= 3.28    <= 20.15²
 # 3.6  <= 2.11    <= 2.16    <= 6.2     <= 3.2.20  <= 3.0.3   <= 21                 <= 7.0.1   <= 3.28    <= 20.17²
-# 3.7  <= 2.12               <= 7.2.7   <= 3.2.20                                   <= 7.4.4   <= 4.8.0
+# 3.7  <= 2.12    <= 2.17    <= 7.2.7   <= 3.2.20                                   <= 7.4.4   <= 4.8.0
 # 3.8  <= 2.12
 # 3.9  <= 2.15
-# 3.10
+# 3.10 <= 2.17
 # 3.11
 # 3.12            >= 2.13¹
 #
@@ -46,16 +46,17 @@
 # ansible == 8.x     ansible-core ~= 2.15.0
 # ansible == 9.x     ansible-core ~= 2.16.0
 # ansible == 10.x    ansible-core ~= 2.17.0
+# ansible == 11.x    ansible-core ~= 2.18.0
 
 # See also
-# - https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
+# - https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
 
 [tox]
 envlist =
     init,
     py{27,36}-mode_ansible-ansible{2.10,3,4},
     py{311}-mode_ansible-ansible{2.10,3,4,5},
-    py{313}-mode_ansible-ansible{6,7,8,9,10},
+    py{313}-mode_ansible-ansible{6,7,8,9,10,11},
     py{27,36,313}-mode_mitogen,
     report,
 
@@ -84,6 +85,7 @@ deps =
     ansible8: ansible~=8.0
     ansible9: ansible~=9.0
     ansible10: ansible~=10.0
+    ansible11: ansible>=11.0.0a2
 install_command =
     python -m pip --no-python-version-warning --disable-pip-version-check install {opts} {packages}
 commands_pre =
@@ -111,6 +113,8 @@ setenv =
     ansible9: MITOGEN_TEST_DISTRO_SPECS=centos7 centos8 debian9 debian10 debian11 ubuntu1804 ubuntu2004
     # Ansible 10 (ansible-core 2.17) requires Python >= 3.7 on targets
     ansible10: MITOGEN_TEST_DISTRO_SPECS=debian10-py3 debian11-py3 ubuntu2004-py3
+    # Ansible 11 (ansible-core 2.18) requires Python >= 3.8 on targets
+    ansible11: MITOGEN_TEST_DISTRO_SPECS=debian11-py3 ubuntu2004-py3
     distros_centos: MITOGEN_TEST_DISTRO_SPECS=centos6 centos7 centos8
     distros_centos5: MITOGEN_TEST_DISTRO_SPECS=centos5
     distros_centos6: MITOGEN_TEST_DISTRO_SPECS=centos6
