Open offlinejke opened 2 years ago
Did you check you aren't affected by one of the known problems listed here? https://docs.ansible.com/ansible/devel/collections/community/routeros/docsite/ssh-guide.html#important-notes
I can connect by ssh. In routeros log i can see user login string. But then command don't executed or work.
I'm asking because of
The SSH-based modules do not support arbitrary symbols in the router’s identity. If you are having trouble connecting to your device, please make sure that your MikroTik’s identity contains only alphanumeric characters and dashes. Also make sure that the identity string is not longer than 19 characters (see issue for details). Similar problems can happen for unsupported characters in your username.
the first point in the link. That triggers exactly the behavior you describe.
root@deb02:/etc/ansible# cat community
- name: RouterOS test with network_cli connection
hosts: community
gather_facts: false
connection: ansible.netcommon.network_cli
tasks:
- name: upgrade packages
community.routeros.command:
commands:
- /system routerboard print
root@deb02:/etc/ansible# ansible-playbook community
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. Current version: 3.5.3 (default, Apr 5 2021, 09:00:41) [GCC 6.3.0 20170516]. This feature will be
removed from ansible-core in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
/usr/local/lib/python3.5/dist-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
from cryptography.exceptions import InvalidSignature
PLAY [RouterOS test with network_cli connection] ******************************************************************************************************************************************************************
TASK [upgrade packages] *******************************************************************************************************************************************************************************************
ok: [analytics]
fatal: [-coffepoint]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "timeout value 30 seconds reached while trying to send command: b'/system resource print'"}
PLAY RECAP ********************************************************************************************************************************************************************************************************
-coffepoint : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
analytics : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
SUMMARY
I have a list of MikroTik cAP ac in my inventory. On some devices, task crashes when doing a simple task, while others do it successfully. fatal: [router]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "timeout value 30 seconds reached while trying to send command: b'/system resource print'"}
ISSUE TYPE
COMPONENT NAME
community.routeros.command
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
cAP ac firmware: 6.48.4 board-name: cAP ac model: RBcAPGi-5acD2nD revision: r2 serial-number: B9320B9EF0D4 firmware-type: ipq4000L factory-firmware: 6.44 OS Distributor ID: Debian Description: Debian GNU/Linux 9.13 (stretch) Release: 9.13 Codename: stretch
STEPS TO REPRODUCE
[community] host ansible_host=10.10.5.105 [community:vars] ansible_connection=ansible.netcommon.network_cli ansible_network_os=community.routeros.routeros ansible_user=user ansible_ssh_private_key_file=/root/.ssh/id_rsa ansible_connection=network_cli ansible_ssh_extra_args='-o StrictHostKeyChecking=no'
EXPECTED RESULTS
ok: [host]
ACTUAL RESULTS
fatal: [host]: FAILED! => {"changed": false, "msg": "timeout value 30 seconds reached while trying to send command: b'/system resource print'"} or fatal: [host]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "timeout value 30 seconds reached while trying to send command: b'/system resource print'"}