Closed agpy closed 3 years ago
Did you see https://github.com/ansible-collections/community.routeros#prerequisites ? Maybe it's because of that.
Thank you, I verify identities on my devices and they are ok (have not arbitrary symbols). Problem appears if I insert dash in the username. If I remove a dash from the username the problem goes away.
@felixfontein, I guess we could support that — most operating systems allow alphanumeric characters, underscores and hyphens in the username. Will open a PR tomorrow, if you don't mind.
SUMMARY
If the username contains a dash "-" (something like "ssh-admin"), the connection timeout error will appear.
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Debian buster
STEPS TO REPRODUCE
Make the username with a dash inside it (eg ssh-admin) for login on routeros device. And then try to start playbook with him.
EXPECTED RESULTS
PLAY [RouterOS test with network_cli connection] ****
TASK [community.routeros.command] *** ok: [172.16.10.172]
TASK [debug] **** ok: [172.16.10.172] => { "system_resource_print.stdout_lines": [ [ "uptime: 1w3d23h36m54s", " version: 6.46.8 (long-term)", " build-time: Oct/29/2020 08:29:55", " free-memory: 189.3MiB", " total-memory: 224.0MiB", " cpu: Intel(R)", " cpu-count: 4", " cpu-frequency: 2400MHz", " cpu-load: 0%", " free-hdd-space: 31.3MiB", " total-hdd-space: 63.5MiB", " write-sect-since-reboot: 3600", " write-sect-total: 3601", " architecture-name: x86_64", " board-name: CHR", " platform: MikroTik" ] ] }
TASK [community.routeros.facts] ***** ok: [172.16.10.172]
TASK [debug] **** ok: [172.16.10.172] => { "msg": "First IP address: 172.16.10.172" }
PLAY RECAP ** 172.16.10.172 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ACTUAL RESULTS
The full traceback is: File "/tmp/ansible_community.routeros.command_payload_jqwdps2f/ansible_community.routeros.command_payload.zip/ansible_collections/community/routeros/plugins/module_utils/routeros.py", line 74, in get_capabilities capabilities = Connection(module._socket_path).get_capabilities() File "/tmp/ansible_community.routeros.command_payload_jqwdps2f/ansible_community.routeros.command_payload.zip/ansible/module_utils/connection.py", line 195, in rpc raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code) fatal: [172.16.10.172]: FAILED! => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "invocation": { "module_args": { "commands": [ "/system resource print" ], "interval": 1, "match": "all", "retries": 10, "wait_for": null } }, "msg": "timeout value 30 seconds reached while trying to send command: b'/system resource print'" }