Cannot connect to Mikrotik

Hello All
I had this ansible server for almost 2 years and for almost 2 years the ansible work fine , but last month I had problem, the ansible cannot connect to mikrotik
I got this error

The full traceback is:

Traceback (most recent call last):
  File "/home/dosen/.ansible/tmp/ansible-local-6498h0vdr2gy/ansible-tmp-1696550165.801094-6503-79510264699825/AnsiballZ_routeros_command.py", line 102, in <module>
    _ansiballz_main()
  File "/home/dosen/.ansible/tmp/ansible-local-6498h0vdr2gy/ansible-tmp-1696550165.801094-6503-79510264699825/AnsiballZ_routeros_command.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/dosen/.ansible/tmp/ansible-local-6498h0vdr2gy/ansible-tmp-1696550165.801094-6503-79510264699825/AnsiballZ_routeros_command.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible.modules.network.routeros.routeros_command', init_globals=None, run_name='__main__', alter_sys=True)
  File "/opt/anaconda3/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/opt/anaconda3/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/opt/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/modules/network/routeros/routeros_command.py", line 187, in <module>
  File "/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/modules/network/routeros/routeros_command.py", line 157, in main
  File "/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py", line 125, in run_commands
  File "/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py", line 55, in get_connection
  File "/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py", line 69, in get_capabilities
  File "/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/module_utils/connection.py", line 185, in __rpc__
ansible.module_utils.connection.ConnectionError: [Errno None] Unable to connect to port 21112 on 72.6.20.122
fatal: [72.26.204.188]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/dosen/.ansible/tmp/ansible-local-6498h0vdr2gy/ansible-tmp-1696550165.801094-6503-79510264699825/AnsiballZ_routeros_command.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/dosen/.ansible/tmp/ansible-local-6498h0vdr2gy/ansible-tmp-1696550165.801094-6503-79510264699825/AnsiballZ_routeros_command.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/dosen/.ansible/tmp/ansible-local-6498h0vdr2gy/ansible-tmp-1696550165.801094-6503-79510264699825/AnsiballZ_routeros_command.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.network.routeros.routeros_command', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/opt/anaconda3/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/opt/anaconda3/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/opt/anaconda3/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/modules/network/routeros/routeros_command.py\", line 187, in <module>\n  File \"/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/modules/network/routeros/routeros_command.py\", line 157, in main\n  File \"/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py\", line 125, in run_commands\n  File \"/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py\", line 55, in get_connection\n  File \"/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py\", line 69, in get_capabilities\n  File \"/tmp/ansible_routeros_command_payload_qk35iqza/ansible_routeros_command_payload.zip/ansible/module_utils/connection.py\", line 185, in __rpc__\nansible.module_utils.connection.ConnectionError: [Errno None] Unable to connect to port 21112 on 72.6.20.122\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Any Idea how to fix this?

Does this look right? Any other info you can provide, did you upgrade a content collection, upgrade your Ansible-Core version? etc?

1 Like