diff --git a/ansible_mitogen/transport_config.py b/ansible_mitogen/transport_config.py
index ae8a02585..bff27d162 100644
--- a/ansible_mitogen/transport_config.py
+++ b/ansible_mitogen/transport_config.py
@@ -434,7 +434,7 @@ def remote_addr(self):
return self._play_context.remote_addr
def remote_user(self):
- return self._play_context.remote_user
+ return self._connection_option('remote_user')
def become(self):
return self._play_context.become
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 7a25f7559..dc42eaf71 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -23,6 +23,8 @@ In Progress (unreleased)
* :gh:issue:`1138` CI: Complete migration from Azure DevOps Pipelines to
GitHub Actions
+* :gh:issue:`1116` :mod:`ansible_mitogen`: Support for templated variable
+ `ansible_ssh_user`.
v0.3.11 (2024-10-07)
diff --git a/docs/contributors.rst b/docs/contributors.rst
index 4e9e58bde..69dc1e76e 100644
--- a/docs/contributors.rst
+++ b/docs/contributors.rst
@@ -127,6 +127,7 @@ sponsorship and outstanding future-thinking of its early adopters.
jgadling
John F Wall — Making Ansible Great with Massive Parallelism
Jonathan Rosser
+ Joshua M. Keyes
KennethC
Luca Berruti
Lewis Bellwood — Happy to be apart of a great project.
diff --git a/tests/ansible/hosts/default.hosts b/tests/ansible/hosts/default.hosts
index 8ed807879..e2a13b477 100644
--- a/tests/ansible/hosts/default.hosts
+++ b/tests/ansible/hosts/default.hosts
@@ -25,11 +25,10 @@ tt-bare
[tt_targets_bare:vars]
ansible_host=localhost
-ansible_user=mitogen__has_sudo_nopw
[tt_targets_inventory]
-tt-password ansible_password="{{ 'has_sudo_nopw_password' | trim }}"
+tt-password ansible_password="{{ 'has_sudo_nopw_password' | trim }}" ansible_user=mitogen__has_sudo_nopw
+tt-remote-user ansible_password=has_sudo_nopw_password ansible_user="{{ 'mitogen__has_sudo_nopw' | trim }}"
[tt_targets_inventory:vars]
ansible_host=localhost
-ansible_user=mitogen__has_sudo_nopw
diff --git a/tests/ansible/integration/ssh/templated_by_play_taskvar.yml b/tests/ansible/integration/ssh/templated_by_play_taskvar.yml
index bc4ef1d83..5a937fb94 100644
--- a/tests/ansible/integration/ssh/templated_by_play_taskvar.yml
+++ b/tests/ansible/integration/ssh/templated_by_play_taskvar.yml
@@ -3,6 +3,7 @@
gather_facts: false
vars:
ansible_password: "{{ 'has_sudo_nopw_password' | trim }}"
+ ansible_user: "{{ 'mitogen__has_sudo_nopw' | trim }}"
tasks:
- meta: reset_connection
diff --git a/tests/ansible/templates/test-targets.j2 b/tests/ansible/templates/test-targets.j2
index 37a0725a2..1166cc428 100644
--- a/tests/ansible/templates/test-targets.j2
+++ b/tests/ansible/templates/test-targets.j2
@@ -47,12 +47,11 @@ tt-bare
ansible_host={{ tt.hostname }}
ansible_port={{ tt.port }}
ansible_python_interpreter={{ tt.python_path }}
-ansible_user=mitogen__has_sudo_nopw
[tt_targets_inventory]
-tt-password ansible_password="{{ '{{' }} 'has_sudo_nopw_password' | trim {{ '}}' }}" ansible_port={{ tt.port }}
+tt-password ansible_password="{{ '{{' }} 'has_sudo_nopw_password' | trim {{ '}}' }}" ansible_port={{ tt.port }} ansible_user=mitogen__has_sudo_nopw
+tt-remote-user ansible_password=has_sudo_nopw_password ansible_port={{ tt.port }} ansible_user="{{ '{{' }} 'mitogen__has_sudo_nopw' | trim {{ '}}' }}"
[tt_targets_inventory:vars]
ansible_host={{ tt.hostname }}
ansible_python_interpreter={{ tt.python_path }}
-ansible_user=mitogen__has_sudo_nopw