Open archhorde opened 2 years ago
You are passing two commands concatenated as a single one. Please use a YAML list to pass two separate commands:
commands:
- /tool fetch address=10.10.72.2 src-path=/srv/ftp/enable-dhcp-snooping-crs326.rsc user=xxx password=xxx dst-path=enable-dhcp-snooping-crs326.rsc port=21 mode=ftp
- /import enable-dhcp-snooping-crs326.rsc
Hi,
I have had this exact syntax working with other playbooks, it seems odd that it would not work here. But when I separated them into two tasks it worked. Was this something changed in a recent update? Thank you for the advice.
It might have been random luck that it worked in other cases. The command module passes commands over SSH, which is quite sensitive to a lot of things, so things can easily go wrong even if things seem to work fine in similar other cases.
SUMMARY
I have tried running a known good old playbook and a newer playbook that do similar things, the tasks say they completed but the commands are not run on the Mikrotik devices. The playbooks are simple, all they do is download a file with ftp and then run the scrip with import. I am able to run the same commands manually on the devices, so it doesn't appear to be an issue there. I also tried putting the individual commands instead of downloading the script but that made difference. The error appears to be ansible splitting up the commands into multiple lines which causes Mikrotik to not know how to proceed but I could be wrong. I have updated everything on the server using apt and rebooted the server with no change.
ISSUE TYPE
COMPONENT NAME
MIkrotik RouterOS
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Running on Ubuntu 20
STEPS TO REPRODUCE
EXPECTED RESULTS
No output from the playbook but the devices should be changed. The contents of the Mikrotik script are below, all it's doing is enabling dhcp snooping and then setting a few ports to trusted.
/int bridge set dhcp-snooping=yes numbers=0 /int bridge port set trusted=yes numbers=0 /int bridge port set trusted=yes numbers=24 /int bridge port set trusted=yes numbers=25
ACTUAL RESULTS
The mikrotik devices show that ansible logs in like usual, but then the file is never downloaded or ran. Note that if I do the fetch and import commands manually it works fine. Replaced user/pass as usual.