network_cli+ssh + jumphost: ansible_ssh_common_args is ignored

Hey there,

There are some issues regarding the proxy commands that are inherited from open issues in Paramiko itself, where it fails to pick up the arguments correctly that end in failure.
You may re-order the arguments withing the ansible_ssh_common_args as such - ansible_ssh_common_args: '-o ProxyCommand="ssh -i ~/.ssh/KEYFILEOFBASTIONHOST.pem -W %h:%p -q -p 2022 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null xxxx@zzzzz

Hope it helps.
Regards

Sagar Paul
E- sagpaul@redhat.com
GH - KB-perByte

Hi,

thanks for your answer.

i have set the variable this way:

ansible_ssh_common_args: ‘-o ProxyCommand="ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null login@JUMP_HOST " -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null’

and there is no trace in ansible logs that ansible is trying to use this variable, no proxy connect attempts.

shouldn’t there be information in debug log ?

Regards,

sorry i have said something wrong. i don’t see anything in ouput but in log i can see that:

2022-03-29 17:59:36,971 p=1451 u=mylogin n=ansible | <labkvmbigip_16_0_0_1.public.nas-x35g.lab> ESTABLISH PARAMIKO SSH CONNECTION FOR USER: root on PORT 22 TO labkvmbigip_16_0_0_1.public.nas-x35g.lab
2022-03-29 17:59:36,974 p=1451 u=mylogin n=ansible | <labkvmbigip_16_0_0_1.public.nas-x35g.lab> CONFIGURE PROXY COMMAND FOR CONNECTION: ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null mylogin@172.16.99.23
2022-03-29 17:59:39,370 p=1451 u=mylogin n=p=1451 u=mylogin | paramiko [labkvmbigip_16_0_0_1.public.nas-x35g.lab] | Exception (client): Error reading SSH protocol banner
2022-03-29 17:59:39,371 p=1451 u=mylogin n=p=1451 u=mylogin | paramiko [labkvmbigip_16_0_0_1.public.nas-x35g.lab] | Traceback (most recent call last):
2022-03-29 17:59:39,371 p=1451 u=mylogin n=p=1451 u=mylogin | paramiko [labkvmbigip_16_0_0_1.public.nas-x35g.lab] | File “/home/mylogin/venv-ansible-2.9-python-2.7/lib/python2.7/site-packages/paramiko/transport.py”, line 2093, in run
2022-03-29 17:59:39,371 p=1451 u=mylogin n=p=1451 u=mylogin | paramiko [labkvmbigip_16_0_0_1.public.nas-x35g.lab] | self._check_banner()
2022-03-29 17:59:39,371 p=1451 u=mylogin n=p=1451 u=mylogin | paramiko [labkvmbigip_16_0_0_1.public.nas-x35g.lab] | File “/home/mylogin/venv-ansible-2.9-python-2.7/lib/python2.7/site-packages/paramiko/transport.py”, line 2275, in _check_banner
2022-03-29 17:59:39,371 p=1451 u=mylogin n=p=1451 u=mylogin | paramiko [labkvmbigip_16_0_0_1.public.nas-x35g.lab] | “Error reading SSH protocol banner” + str(e)
2022-03-29 17:59:39,371 p=1451 u=mylogin n=p=1451 u=mylogin | paramiko [labkvmbigip_16_0_0_1.public.nas-x35g.lab] | SSHException: Error reading SSH protocol banner
2022-03-29 17:59:39,371 p=1451 u=mylogin n=p=1451 u=mylogin | paramiko [labkvmbigip_16_0_0_1.public.nas-x35g.lab] |
2022-03-29 17:59:39,482 p=1451 u=mylogin n=ansible | shutdown complete

regards,

in fact, even a direct cli_command call without bigip_command give the same pb:

  • name: run show version command
    ansible.netcommon.cli_command:
    command: show version
    tags:
  • netcli-collection-command

logs:

2022-03-30 11:29:11,241 p=3199 u=da_ansible n=ansible | Using module_utils file /home/da_ansible/venv-ansible-2.9-python-2.7/lib/python2.7/site-packages/ansible/module_utils/common/json.py
2022-03-30 11:29:11,244 p=3199 u=da_ansible n=ansible | Using module file /home/da_ansible/.ansible/collections/ansible_collections/ansible/netcommon/plugins/modules/cli_command.py
2022-03-30 11:29:11,245 p=3199 u=da_ansible n=ansible | <172.16.99.23> PUT /home/da_ansible/.ansible/tmp/ansible-local-3190zeYu5Z/tmp8EZd8f TO /home/da_ansible/.ansible/tmp/ansible-local-3190zeYu5Z/ansible-tmp-1648639751.15-3199-151113274687612/AnsiballZ_cli_command.py
2022-03-30 11:29:11,245 p=3199 u=da_ansible n=ansible | <172.16.99.23> EXEC /bin/sh -c ‘chmod u+x /home/da_ansible/.ansible/tmp/ansible-local-3190zeYu5Z/ansible-tmp-1648639751.15-3199-151113274687612/ /home/da_ansible/.ansible/tmp/ansible-local-3190zeYu5Z/ansible-tmp-1648639751.15-3199-151113274687612/AnsiballZ_cli_command.py && sleep 0’
2022-03-30 11:29:11,250 p=3199 u=da_ansible n=ansible | <172.16.99.23> EXEC /bin/sh -c ‘python /home/da_ansible/.ansible/tmp/ansible-local-3190zeYu5Z/ansible-tmp-1648639751.15-3199-151113274687612/AnsiballZ_cli_command.py && sleep 0’
2022-03-30 11:29:11,317 p=3207 u=da_ansible n=ansible | jsonrpc request: {“params”: [, {“sendonly”: false, “prompt”: null, “check_all”: false, “newline”: true, “command”: “show version”, “answer”: null}], “jsonrpc”: “2.0”, “method”: “get”, “id”: “d73d563d-74a9-4a55-aad7-997e7372ec3d”}
2022-03-30 11:29:11,318 p=3207 u=da_ansible n=ansible | jsonrpc response: {“jsonrpc”: “2.0”, “id”: “d73d563d-74a9-4a55-aad7-997e7372ec3d”, “error”: {“message”: “Method not found”, “code”: -32601}}
2022-03-30 11:29:11,323 p=3199 u=da_ansible n=ansible | <172.16.99.23> EXEC /bin/sh -c ‘rm -f -r /home/da_ansible/.ansible/tmp/ansible-local-3190zeYu5Z/ansible-tmp-1648639751.15-3199-151113274687612/ > /dev/null 2>&1 && sleep 0’
2022-03-30 11:29:11,331 p=3190 u=da_ansible n=ansible | The full traceback is:
WARNING: The below traceback may not be related to the actual failure.
File “/tmp/ansible_ansible.netcommon.cli_command_payload_oPK79G/ansible_ansible.netcommon.cli_command_payload.zip/ansible_collections/ansible/netcommon/plugins/modules/cli_command.py”, line 169, in main
File “/tmp/ansible_ansible.netcommon.cli_command_payload_oPK79G/ansible_ansible.netcommon.cli_command_payload.zip/ansible/module_utils/connection.py”, line 185, in rpc
raise ConnectionError(to_text(msg, errors=‘surrogate_then_replace’), code=code)

2022-03-30 11:29:11,331 p=3190 u=da_ansible n=ansible | fatal: [labkvmbigip-direct]: FAILED! => {
“changed”: false,
“invocation”: {
“module_args”: {
“answer”: null,
“check_all”: false,
“command”: “show version”,
“newline”: true,
“prompt”: null,
“sendonly”: false
}
},
“msg”: “Method not found”
}