Skip to content

Commit 0b99169

Browse files
committed
Support Ansible 11 (ansible-core 2.18)
1 parent b36806a commit 0b99169

File tree

16 files changed

+74
-78
lines changed

16 files changed

+74
-78
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ jobs:
6363
- name: Ans_313_10
6464
python_version: '3.13'
6565
tox_env: py313-mode_ansible-ansible10
66-
- name: Van_313_10
66+
- name: Ans_313_11
6767
python_version: '3.13'
68-
tox_env: py313-mode_ansible-ansible10-strategy_linear
68+
tox_env: py313-mode_ansible-ansible11
69+
70+
- name: Van_313_11
71+
python_version: '3.13'
72+
tox_env: py313-mode_ansible-ansible11-strategy_linear
6973

7074
- name: Mito_27
7175
tox_env: py27-mode_mitogen
@@ -167,11 +171,11 @@ jobs:
167171
- name: Mito_313
168172
tox_env: py313-mode_mitogen
169173

170-
- name: Loc_313_10
171-
tox_env: py313-mode_localhost-ansible10
174+
- name: Loc_313_11
175+
tox_env: py313-mode_localhost-ansible11
172176

173-
- name: Van_313_10
174-
tox_env: py313-mode_localhost-ansible10-strategy_linear
177+
- name: Van_313_11
178+
tox_env: py313-mode_localhost-ansible11-strategy_linear
175179

176180
steps:
177181
- uses: actions/checkout@v4

ansible_mitogen/loaders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050

5151
ANSIBLE_VERSION_MIN = (2, 10)
52-
ANSIBLE_VERSION_MAX = (2, 17)
52+
ANSIBLE_VERSION_MAX = (2, 18)
5353

5454
NEW_VERSION_MSG = (
5555
"Your Ansible version (%s) is too recent. The most recent version\n"

docs/ansible_detailed.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ Noteworthy Differences
141141
+-----------------+ 3.10 - 3.13 |
142142
| 10 | |
143143
+-----------------+-----------------+
144+
| 11 | 3.11 - 3.13 |
145+
+-----------------+-----------------+
144146

145147
Verify your installation is running one of these versions by checking
146148
``ansible --version`` output.

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ To avail of fixes in an unreleased version, please download a ZIP file
2121
In progress (unreleased)
2222
------------------------
2323

24+
* :gh:issue:`1129` :mod:`ansible_mitogen`: Ansible 11 support
2425

2526

2627
v0.3.18 (2024-11-07)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
---
2+
become_unpriv_available: >-
3+
{#
4+
Vanilla Ansible >= 4 (ansible-core >= 2.11) can use `setfacl` for
5+
unpriv -> unpriv, but Mitogen test containers lack setfacl
6+
https://github.com/mitogen-hq/mitogen/issues/1118
7+
8+
Mitogen + Ansible can do unpriv -> unpriv without temporary files,
9+
but Ansible >= 11 (ansible-core >= 2.18) detection tries to use Python
10+
3.13 which hits https://github.com/python/cpython/issues/115911 on macOS.
11+
#}
12+
{{-
13+
(
14+
not is_mitogen
15+
and ansible_facts.distribution in ["MacOSX"]
16+
and ansible_version.full is version("2.11", ">=", strict=True)
17+
)
18+
or (
19+
is_mitogen
20+
and not ansible_facts.distribution in ["MacOSX"]
21+
)
22+
or (
23+
is_mitogen
24+
and ansible_python_interpreter is not defined
25+
and ansible_version.full is version("2.18", "<", strict=True)
26+
)
27+
-}}
28+
229
pkg_mgr_python_interpreter: python
330
pkg_repos_overrides: []

tests/ansible/integration/action/make_tmp_path.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@
152152
result['path'] = path
153153
open(path, 'w').write("bar")
154154
register: tmp_path
155+
when:
156+
- become_unpriv_available
155157

156158
#
157159
# modules get the same base dir

tests/ansible/integration/become/su_password.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,15 @@
5555
vars:
5656
ansible_become_pass: user1_password
5757
when:
58-
# CI containers lack `setfacl` for unpriv -> unpriv
59-
# https://github.com/mitogen-hq/mitogen/issues/1118
60-
- is_mitogen
61-
or (ansible_facts.distribution in ["MacOSX"]
62-
and ansible_version.full is version("2.11", ">=", strict=True))
58+
- become_unpriv_available
6359

6460
- assert:
6561
that:
6662
- out.stdout == 'mitogen__user1'
6763
fail_msg: |
6864
out={{ out }}
6965
when:
70-
# CI containers lack `setfacl` for unpriv -> unpriv
71-
# https://github.com/mitogen-hq/mitogen/issues/1118
72-
- is_mitogen
73-
or (ansible_facts.distribution in ["MacOSX"]
74-
and ansible_version.full is version("2.11", ">=", strict=True))
66+
- become_unpriv_available
7567

7668
- name: Ensure password su without chdir succeeds
7769
shell: whoami
@@ -81,23 +73,15 @@
8173
vars:
8274
ansible_become_pass: user1_password
8375
when:
84-
# CI containers lack `setfacl` for unpriv -> unpriv
85-
# https://github.com/mitogen-hq/mitogen/issues/1118
86-
- is_mitogen
87-
or (ansible_facts.distribution in ["MacOSX"]
88-
and ansible_version.full is version("2.11", ">=", strict=True))
76+
- become_unpriv_available
8977

9078
- assert:
9179
that:
9280
- out.stdout == 'mitogen__user1'
9381
fail_msg: |
9482
out={{ out }}
9583
when:
96-
# CI containers lack `setfacl` for unpriv -> unpriv
97-
# https://github.com/mitogen-hq/mitogen/issues/1118
98-
- is_mitogen
99-
or (ansible_facts.distribution in ["MacOSX"]
100-
and ansible_version.full is version("2.11", ">=", strict=True))
84+
- become_unpriv_available
10185

10286
tags:
10387
- su

tests/ansible/integration/become/sudo_nonexistent.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
ignore_errors: true
1010
register: out
1111
when:
12-
# https://github.com/ansible/ansible/pull/70785
13-
- ansible_facts.distribution not in ["MacOSX"]
14-
or ansible_version.full is version("2.11", ">=", strict=True)
15-
or is_mitogen
12+
- become_unpriv_available
1613

1714
- name: Verify raw module output.
1815
assert:
@@ -26,10 +23,7 @@
2623
fail_msg: |
2724
out={{ out }}
2825
when:
29-
# https://github.com/ansible/ansible/pull/70785
30-
- ansible_facts.distribution not in ["MacOSX"]
31-
or ansible_version.full is version("2.11", ">=", strict=True)
32-
or is_mitogen
26+
- become_unpriv_available
3327
tags:
3428
- sudo
3529
- sudo_nonexistent

tests/ansible/integration/become/sudo_password.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
changed_when: false
1414
ignore_errors: true
1515
when:
16-
# https://github.com/ansible/ansible/pull/70785
17-
- ansible_facts.distribution not in ["MacOSX"]
18-
or ansible_version.full is version("2.11", ">=", strict=True)
19-
or is_mitogen
16+
- become_unpriv_available
2017

2118
- assert:
2219
that: |
@@ -28,10 +25,7 @@
2825
fail_msg: |
2926
out={{ out }}
3027
when:
31-
# https://github.com/ansible/ansible/pull/70785
32-
- ansible_facts.distribution not in ["MacOSX"]
33-
or ansible_version.full is version("2.11", ">=", strict=True)
34-
or is_mitogen
28+
- become_unpriv_available
3529

3630
- name: Ensure password sudo incorrect.
3731
become: true
@@ -44,10 +38,7 @@
4438
ansible_become_pass: nopes
4539
ignore_errors: true
4640
when:
47-
# https://github.com/ansible/ansible/pull/70785
48-
- ansible_facts.distribution not in ["MacOSX"]
49-
or ansible_version.full is version("2.11", ">=", strict=True)
50-
or is_mitogen
41+
- become_unpriv_available
5142

5243
- assert:
5344
that: |
@@ -58,10 +49,7 @@
5849
fail_msg: |
5950
out={{ out }}
6051
when:
61-
# https://github.com/ansible/ansible/pull/70785
62-
- ansible_facts.distribution not in ["MacOSX"]
63-
or ansible_version.full is version("2.11", ">=", strict=True)
64-
or is_mitogen
52+
- become_unpriv_available
6553

6654
- block:
6755
- name: Ensure password sudo succeeds
@@ -80,10 +68,7 @@
8068
fail_msg: |
8169
sudo_password_success_whoami={{ sudo_password_success_whoami }}
8270
when:
83-
# https://github.com/ansible/ansible/pull/70785
84-
- ansible_facts.distribution not in ["MacOSX"]
85-
or ansible_version.full is version("2.11", ">=", strict=True)
86-
or is_mitogen
71+
- become_unpriv_available
8772
tags:
8873
- sudo
8974
- sudo_password

tests/ansible/integration/become/sudo_requiretty.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@
1313
cmd: whoami
1414
changed_when: false
1515
register: sudo_require_tty_whoami
16+
when:
17+
- become_unpriv_available
1618

1719
- assert:
1820
that:
1921
- sudo_require_tty_whoami.stdout == 'mitogen__require_tty'
2022
fail_msg: |
2123
sudo_require_tty_whoami={{ sudo_require_tty_whoami }}
24+
when:
25+
- become_unpriv_available
2226

2327
- name: Verify we can login to a passworded requiretty account
2428
become: true
@@ -29,12 +33,16 @@
2933
cmd: whoami
3034
changed_when: false
3135
register: sudo_require_tty_password_whoami
36+
when:
37+
- become_unpriv_available
3238

3339
- assert:
3440
that:
3541
- sudo_require_tty_password_whoami.stdout == 'mitogen__require_tty_pw_required'
3642
fail_msg: |
3743
sudo_require_tty_password_whoami={{ sudo_require_tty_password_whoami }}
44+
when:
45+
- become_unpriv_available
3846
tags:
3947
- mitogen_only
4048
- sudo

0 commit comments

Comments
 (0)