diff --git a/docs/changelog.rst b/docs/changelog.rst index 449e8d039..bc7e0cfe9 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -29,6 +29,7 @@ In progress (unreleased) (e.g. ``ansible_host_key_checking``, ``ansible_ssh_host_key_checking``). * :gh:issue:`1083` :mod:`ansible_mitogen`: Templated host address (e.g. ``ansible_host``, ``ansible_ssh_host``) +* :gh:issue:`978` Test templated port provided by Ansible play or task keyword v0.3.16 (2024-11-05) diff --git a/tests/ansible/integration/ssh/templated_by_play_keyword.yml b/tests/ansible/integration/ssh/templated_by_play_keyword.yml index c6ff1674e..ee9046f44 100644 --- a/tests/ansible/integration/ssh/templated_by_play_keyword.yml +++ b/tests/ansible/integration/ssh/templated_by_play_keyword.yml @@ -1,11 +1,11 @@ - name: integration/ssh/templated_by_play_keyword.yml hosts: tt_targets_bare gather_facts: false + port: "{{ hostvars[groups['test-targets'][0]].ansible_port | default(22) }}" remote_user: "{{ 'mitogen__has_sudo_nopw' | trim }}" vars: ansible_host: "{{ hostvars[groups['test-targets'][0]].host | default('localhost') }}" ansible_password: has_sudo_nopw_password - ansible_port: "{{ hostvars[groups['test-targets'][0]].ansible_port | default(22) }}" tasks: - meta: reset_connection - name: Templated variables in play keywords diff --git a/tests/ansible/integration/ssh/templated_by_task_keyword.yml b/tests/ansible/integration/ssh/templated_by_task_keyword.yml index dc16205a9..62b582b96 100644 --- a/tests/ansible/integration/ssh/templated_by_task_keyword.yml +++ b/tests/ansible/integration/ssh/templated_by_task_keyword.yml @@ -3,11 +3,11 @@ gather_facts: false # FIXME Resetting the connection shouldn't require credentials # https://github.com/mitogen-hq/mitogen/issues/1132 + port: "{{ hostvars[groups['test-targets'][0]].ansible_port | default(22) }}" remote_user: "{{ 'mitogen__has_sudo_nopw' | trim }}" vars: ansible_host: "{{ hostvars[groups['test-targets'][0]].host | default('localhost') }}" ansible_password: has_sudo_nopw_password - ansible_port: "{{ hostvars[groups['test-targets'][0]].ansible_port | default(22) }}" tasks: - name: Reset connection to target that will be delegate_to meta: reset_connection @@ -18,9 +18,9 @@ tasks: - name: Templated by task keywords, with delegate_to delegate_to: "{{ groups.tt_targets_bare[0] }}" + port: "{{ hostvars[groups['test-targets'][0]].ansible_port | default(22) }}" remote_user: "{{ 'mitogen__has_sudo_nopw' | trim }}" vars: ansible_host: "{{ hostvars[groups['test-targets'][0]].host | default('localhost') }}" ansible_password: has_sudo_nopw_password - ansible_port: "{{ hostvars[groups['test-targets'][0]].ansible_port | default(22) }}" ping: