mitogen-hq / mitogen

Distributed self-replicating programs in Python
https://mitogen.networkgenomics.com/
BSD 3-Clause "New" or "Revised" License
2.34k stars 199 forks source link

tests: templated remote_user keyword with delegate_to #1154

Closed moreati closed 1 month ago

moreati commented 1 month ago

refs #1040

moreati commented 1 month ago

Templated port keyword fails, but only on the combination macOS with Ansible 20 (ansible-core 2.17). Both Mitogen+Ansible and vanilla Ansible are affected

- 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_password: has_sudo_nopw_password
  tasks:
    - meta: reset_connection
    - name: Templated variables in play keywords
      ping:
PLAY [integration/ssh/templated_by_play_keyword.yml] ***************************

TASK [meta _raw_params=reset_connection] ***************************************
Wednesday 09 October 2024  13:49:22 +0000 (0:00:01.514)       0:04:22.030 ***** 
ERROR! Invalid type for configuration option plugin_type: connection plugin: mitogen_ssh setting: port (from keyword: port): invalid literal for int() with base 10: "{{ hostvars[groups['test-targets'][0]].ansible_port | default(22) }}"
usage: ansible-playbook [-h] [--version] [-v] [--private-key PRIVATE_KEY_FILE]
                        [-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT]
PLAY [integration/ssh/templated_by_play_keyword.yml] ***************************

TASK [meta _raw_params=reset_connection] ***************************************
Wednesday 09 October 2024  13:50:11 +0000 (0:00:20.686)       0:04:39.457 ***** 
ERROR! Invalid type for configuration option plugin_type: connection plugin: ssh setting: port (from keyword: port): invalid literal for int() with base 10: "{{ hostvars[groups['test-targets'][0]].ansible_port | default(22) }}"
usage: ansible-playbook [-h] [--version] [-v] [--private-key PRIVATE_KEY_FILE]
                        [-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT]