Getting SSH server unreachable error when executing ansible scripts

Hi Team, I’m running an Ansible playbook with Python 3.8.23 and Ansible 2.9.27 to maintain compatibility with some existing scripts. When executing the playbook, I’m encountering the following SSH error:

fatal: [host-alias.domain.example.com]: UNREACHABLE! => {
“changed”: false,
“msg”: “Failed to connect to the host via ssh: OpenSSH_9.6p1 Ubuntu-3ubuntu3.12, OpenSSL 3.0.13 30 Jan 2024\r
debug1: Reading configuration data /home/user/.ssh/config\r
debug1: /home/user/.ssh/config line 10: Applying options for domain.example.com\r
debug1: Reading configuration data /etc/ssh/ssh_config\r
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/*.conf matched no files\r
debug1: expanded UserKnownHostsFile ‘~/.ssh/known_hosts2’ → ‘/home/user/.ssh/known_hosts2’\r
debug1: expanded UserKnownHostsFile ‘~/.ssh/known_hosts’ → ‘/home/user/.ssh/known_hosts’\r
debug1: identity file /home/user/.ssh/id_privx type -1\r
debug1: identity file /home/user/.ssh/id_privx-cert type -1\r
debug1: Local version string SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu3.12\r
debug1: Connection timed out during banner exchange\r
kex_exchange_identification: Connection to UNKNOWN port 65535 timed out\r”,
“unreachable”: true
}

  • Manual SSH works fine using privx-cmd.exe
  • The same server is reachable via `ping’
  • SSH config points to privx-cmd proxy command.
  • Problem occurs only during ansible playbook execution

How can I resolve the SSH UNREACHABLE error when using Ansible with PrivX proxy-based SSH while manual SSH works fine?

Any pointers or experiences appreciated. Thanks.

full output of the the task with -vvv would help, it will show the actual ssh command ansible is running and you can probably see what the issue is there.