Hello Experts,
I have installed ansible using homebrew.
While trying to run few IOS command from my mac PC via jump server I am getting below errors.
<x.x.x.x1> ESTABLISH LOCAL CONNECTION FOR USER: root
<x.x.x.x1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /var/root/.ansible/tmp/ansible-local-13708nory1o1s
”&& mkdir “echo /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984
” && echo ansible-tmp-1622963425.282479-13711-84468633356984=“echo /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984
” ) && sleep 0’
<x.x.x.x1> Attempting python interpreter discovery
<x.x.x.x1> EXEC /bin/sh -c ‘echo PLATFORM; uname; echo FOUND; command -v ‘"’"’/usr/bin/python’“'”‘; command -v ‘"’“‘python3.7’”’“'; command -v '”‘“‘python3.6’”’“'; command -v '”‘“‘python3.5’”’“'; command -v '”‘“‘python2.7’”’“'; command -v '”‘“‘python2.6’”’“'; command -v '”‘"’/usr/libexec/platform-python’“'”‘; command -v ‘"’"’/usr/bin/python3’“'”‘; command -v ‘"’“‘python’”’"‘; echo ENDFOUND && sleep 0’
<x.x.x.x1> Python interpreter discovery fallback (unsupported platform for extended discovery: darwin)
Using module file /usr/local/Cellar/ansible/3.4.0/libexec/lib/python3.9/site-packages/ansible_collections/cisco/ios/plugins/modules/ios_command.py
<x.x.x.x1> PUT /private/var/root/.ansible/tmp/ansible-local-13708nory1o1s/tmp0d1cl3d7 TO /private/var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/AnsiballZ_ios_command.py
<x.x.x.x1> EXEC /bin/sh -c ‘chmod u+x /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/ /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/AnsiballZ_ios_command.py && sleep 0’
<x.x.x.x1> EXEC /bin/sh -c ‘/usr/bin/python /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/AnsiballZ_ios_command.py && sleep 0’
<x.x.x.x1> EXEC /bin/sh -c ‘rm -f -r /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/ > /dev/null 2>&1 && sleep 0’
The full traceback is:
WARNING: The below traceback may not be related to the actual failure.
File “/tmp/ansible_cisco.ios.ios_command_payload_LjBijq/ansible_cisco.ios.ios_command_payload.zip/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py”, line 94, in get_capabilities
capabilities = Connection(module._socket_path).get_capabilities()
File “/tmp/ansible_cisco.ios.ios_command_payload_LjBijq/ansible_cisco.ios.ios_command_payload.zip/ansible/module_utils/connection.py”, line 195, in rpc
raise ConnectionError(to_text(msg, errors=‘surrogate_then_replace’), code=code)
[WARNING]: Platform darwin on host x.x.x.x1 is using the discovered Python interpreter at /usr/bin/python, but future installation
of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information.
fatal: [x.x.x.x1]: FAILED! => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python”
},
“changed”: false,
“invocation”: {
“module_args”: {
“commands”: [
“show version”
],
“interval”: 1,
“match”: “all”,
“provider”: null,
“retries”: 10,
“wait_for”: null
}
},
“msg”: “[Errno None] Unable to connect to port 22 on x.x.x.x1”
ansible 2.10.9
config file = /private/etc/ansible/ansible.cfg
configured module search path = [‘/var/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/Cellar/ansible/3.4.0/libexec/lib/python3.9/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.9.5 (default, May 4 2021, 03:36:27) [Clang 12.0.0 (clang-1200.0.32.29)]
Also i can see it is trying connection with user root although i have defined new user to login to the managed hosts.
Host test1
Hostname x.x.x.x
User subu
IdentityFile ~/.ssh/id_rsa
Host test2
Hostname *
User subu
ProxyJump test1
ForwardAgent yes
host file configuration
bbb
ansible_connection=network_cli
use_persistent_connections=yes
ansible_port=22
ansible_ssh_port=22
ansible_network_os=ios
ansible_user=admin
ansible_ssh_user=admin
ansible_ssh_password=xxx
ansible_password=yyy
ansible.cfg
[defaults]:
inventory = /etc/ansible/bbb
#ask_pass = true
ansible_python_interpreter=/usr/bin/python3
ansible_connection=ssh
ansible_port=22
ansible_ssh_port=22
host_key_checking = no
Br//
Subrat