Closed markmcn closed 3 years ago
Hey @markmcn, thank you for opening an issue. This actually is a very well-known problem and there are two ways to mitigate it. You can add +cet512w
to your username in the playbook to make RouterOS think that your terminal width is 512 columns:
---
example_routeros:
ansible_host: 192.168.88.1
ansible_user: admin+cet512w
ansible_ssh_pass: ''
ansible_network_os: routeros
ansible_connection: network_cli
Or you can use routeros_api
module, which uses RouterOS API and therefore does not face terminal-related issues.
Hi Egor, Thanks for getting back about this issue, Sorry I didn't mean to duplicate reporting of the issue. Cheers for the help
@markmcn, no worries, to be fair we should probably have this documented somewhere 😅
SUMMARY
When the router has a name greater than or equal to 19 char's the return from routeros_command
ISSUE TYPE
COMPONENT NAME
routeros_command command
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Running on RHEL 8 installed using DNF Targeting Mikrotik RouterOS 6.48.2
STEPS TO REPRODUCE
set the router identity/hostname to a name of 19 char's or longer and run the play book with -v switch to see the return. if you repeat the playbook against the same device but change the identity/hostname to a shorter name you'll get the expected result as can be seen in the output with -v
EXPECTED RESULTS
Expecting the current firmware version to be returned as is shown in the output below
ACTUAL RESULTS
After collecting the expected result above I logged into the test device and changed the hostname/identity to ThisIsAReallyLongName and repeated the test. Notice how the stdout of the return now contains mangled copies of the ROS command issued. If you shorten the hostname under the 19 char limit the result goes back to being as expected.