Hi All,
I am trying to configure one line command on Mikoritk but getting below error -
hosts: routers
connection: local
gather_facts: false
tasks:
name: Configure username
routeros_command:
commands:
user add name=ansible group=full password=test1234
quit
“command timeout triggered, timeout value is 60 secs”
I can see ssh login to device but it does not run the command.
here the details of ansible
ansible [core 2.15.9]
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/home/saurav/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/saurav/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True
utoddl
(Todd Lewis)
February 6, 2024, 3:12pm
2
According to https://docs.ansible.com/ansible/latest/collections/community/routeros/docsite/ssh-guide.html#important-notes
The community.routeros.command module does not support nesting commands and expects every command to start with a forward slash (/
) . Running the following command will produce an error:
- community.routeros.command:
commands:
- /ip
- print
It’s the “… and expects every command to start with a forward slash (/) ” bit that I suspect is your problem.
While you’re fixing things, use the FQCN: “community.routeros.command ”. “[community.network.]routeros_command” is deprecated.
Hi Todd,
Thanks for your reply.
I have used the other script with community.routeros.command and receiving the same error with “/” and without"/"
hosts: routers
connection: local
gather_facts: false
tasks:
name: Configure username
community.routeros.command:
commands:
/user add name=ansible group=full password=test
Any other thought ?