ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
62.68k stars 23.86k forks source link

routeros_command – fails with timeout on devices with long identity string #58325

Closed heuels closed 4 years ago

heuels commented 5 years ago
SUMMARY

As reported by @danrimal, @moosehead123 in #53199, when device's identity is greater than 24 characters the request fails with timeout.

Hello, I can also hit this bug, but in my case, maximal working identity is 24 chars. Longer mikrotik identity doesn't work and ending with timeout.

ansible 2.7.9

Hi,

I've also run into this bug. It seems to happen when the overall length of the prompt is greater than 41 characters. In other words, the longer the username, the shorter the identity can be.

Ansible 2.8.0

ISSUE TYPE
COMPONENT NAME

routeros_command

ANSIBLE VERSION
ansible 2.7.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/dinko/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.2 (default, Jan 10 2019, 23:51:51) [GCC 8.2.1 20181127]
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
ansibot commented 5 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

heuels commented 5 years ago
TEMPORARY WORKAROUND

You can add +cet512w to your username in hosts file, this makes the default terminal width equal to 512 cols and enables "dumb" terminal mode.

Your final host definition should look something like this:

---
example_routeros:
    ansible_host: 192.168.88.1
    ansible_user: admin+cet512w
    ansible_ssh_pass: ''
    ansible_network_os: routeros
    ansible_connection: network_cli
groggemans commented 4 years ago

I also noticed that the routeros_command module will have the commands echoed a few times in the registered stdout data if the command is to long. Applying the above mentioned workaround also fixes that behavior.

martydingo commented 4 years ago

This also exists on routeros_facts.

For reference, the +cet512w flag can be added onto the ansible-playbook command like so: -k +cet512w

heuels commented 4 years ago

This also exists on routeros_facts.

Yes, that's true since both modules use the same connection mechanism.

eduardomazolini commented 4 years ago

Same for me. user@domain is my user from Radius user@domain+cet512w not work for me.

NilashishC commented 4 years ago

Thank you very much for your interest in Ansible. This plugin is no longer maintained in this repository and has been migrated to https://github.com/ansible-collections/community.network

Please re-submit this issue in the above repository.

If you have further questions please stop by IRC or the mailing list:

IRC: #ansible on irc.freenode.net mailing list: https://groups.google.com/forum/#!forum/ansible-project