Community discussions

MikroTik App
 
ThePhenex
just joined
Topic Author
Posts: 2
Joined: Thu Aug 27, 2020 5:15 pm

Ansible playbook error

Thu Aug 27, 2020 5:32 pm

Hi,
i have a problem with ansible:
I wrote some playbooks, that do basic things like getting the routeros version from the mikrotik, and the playbook itself seems to works fine.
What i mean by that is that about half of the mikrotiks (all in one network, all reachbale via ssh, all with the same firewall settings ect) send the information that i requested just fine. But with the other half i get this strange error (see below).

I tested it intensively with two mikrotiks ( RB2011UiAS). I compared the config side by side, other then the ip´s (in the same network) everything is 100% the same. Even the software version. Both are reachable via ssh.

"
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: timeout value 10 seconds reached while trying to send command: /system resource print
fatal: [XXX:XXX:XXX:X::XX]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-local-22921xL1Zh9/ansible-tmp-1598512873.3-22929-127716503250274/AnsiballZ_routeros_command.py\", line 102, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-local-22921xL1Zh9/ansible-tmp-1598512873.3-22929-127716503250274/AnsiballZ_routeros_command.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-local-22921xL1Zh9/ansible-tmp-1598512873.3-22929-127716503250274/AnsiballZ_routeros_command.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.routeros.routeros_command', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_routeros_command_payload_VN97ME/ansible_routeros_command_payload.zip/ansible/modules/network/routeros/routeros_command.py\", line 187, in <module>\n File \"/tmp/ansible_routeros_command_payload_VN97ME/ansible_routeros_command_payload.zip/ansible/modules/network/routeros/routeros_command.py\", line 157, in main\n File \"/tmp/ansible_routeros_command_payload_VN97ME/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py\", line 125, in run_commands\n File \"/tmp/ansible_routeros_command_payload_VN97ME/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py\", line 55, in get_connection\n File \"/tmp/ansible_routeros_command_payload_VN97ME/ansible_routeros_command_payload.zip/ansible/module_utils/network/routeros/routeros.py\", line 69, in get_capabilities\n File \"/tmp/ansible_routeros_command_payload_VN97ME/ansible_routeros_command_payload.zip/ansible/module_utils/connection.py\", line 185, in __rpc__\nansible.module_utils.connection.ConnectionError: timeout value 10 seconds reached while trying to send command: /system resource print\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
"
(Xed out the ipv6)


Here is the playbook:
---
 - name: Check mikrotik os version
   hosts: mikrotik
   gather_facts: no

   tasks:
     - name: CHeck OS
       routeros_command:
         commands: /system package print
       register: version_output

     - name: Disply version
       debug:
         var: version_output
I tried it with another playbook, with mikrotiks with older and brand new firmware, set the timeout to 120 seconds, nothing has worked so far.
I also am aware of the problems that some symboles in the username cause, and thats not the case here.
If anyone has an idea what could cause this problem, i would be more then happy.
 
carlosjrbr
just joined
Posts: 1
Joined: Fri Jun 05, 2020 11:00 pm

Re: Ansible playbook error

Mon Oct 12, 2020 10:12 pm

Hello,

Have you found a way to solve your issue?

I have a similar here, using this playbook:
---
- hosts: routers
  gather_facts: false
  tasks:
    - name: Run command on remote devices
      community.network.routeros_command:
        commands: /system routerboard print

And got this output when debugging
carlosjr@jupiter:~/ansible$ ansible-playbook -vvv mt.yml -u admin -k
ansible-playbook 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/carlosjr/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
Using /etc/ansible/ansible.cfg as config file
SSH password: 
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: mt.yml *********************************************************************************************************************************************************************************************
1 plays in mt.yml

PLAY [routers] ***********************************************************************************************************************************************************************************************
META: ran handlers

TASK [Run command on remote devices] *************************************************************************************************************************************************************************
task path: /home/carlosjr/ansible/mt.yml:8
<mt417> ESTABLISH SSH CONNECTION FOR USER: admin
<mt417> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb mt417 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-$USER/ansible-tmp-1602529514.877012-224436382785902 `" && echo ansible-tmp-1602529514.877012-224436382785902="` echo /tmp/ansible-$USER/ansible-tmp-1602529514.877012-224436382785902 `" ) && sleep 0'"'"''
<mt398> ESTABLISH SSH CONNECTION FOR USER: admin
<mt398> SSH: EXEC sshpass -d13 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a mt398 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-$USER/ansible-tmp-1602529514.8817732-87555262573894 `" && echo ansible-tmp-1602529514.8817732-87555262573894="` echo /tmp/ansible-$USER/ansible-tmp-1602529514.8817732-87555262573894 `" ) && sleep 0'"'"''
<mt398> (0, b'syntax error (line 1 column 5)\n', b'')
<mt417> (0, b'syntax error (line 1 column 5)\n', b'')
<mt398> Attempting python interpreter discovery
<mt398> ESTABLISH SSH CONNECTION FOR USER: admin
<mt417> Attempting python interpreter discovery
<mt417> ESTABLISH SSH CONNECTION FOR USER: admin
<mt398> SSH: EXEC sshpass -d13 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a mt398 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<mt417> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb mt417 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<mt417> (0, b'syntax error (line 1 column 5)\n', b'')
<mt398> (1, b'syntax error (line 1 column 5)\n', b'')
Using module file /home/carlosjr/.ansible/collections/ansible_collections/community/network/plugins/modules/routeros_command.py
<mt398> Failed to connect to the host via ssh: 
<mt417> PUT /home/carlosjr/.ansible/tmp/ansible-local-99838qyeksos/tmptt_7p9ke TO syntax error (line 1 column 5)/AnsiballZ_routeros_command.py
<mt417> SSH: EXEC sshpass -d11 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb '[mt417]'
Using module file /home/carlosjr/.ansible/collections/ansible_collections/community/network/plugins/modules/routeros_command.py
<mt398> PUT /home/carlosjr/.ansible/tmp/ansible-local-99838qyeksos/tmpco5ci1di TO syntax error (line 1 column 5)/AnsiballZ_routeros_command.py
<mt398> SSH: EXEC sshpass -d13 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a '[mt398]'
[WARNING]: sftp transfer mechanism failed on [mt417]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: sftp transfer mechanism failed on [mt398]. Use ANSIBLE_DEBUG=1 to see detailed information
<mt417> SSH: EXEC sshpass -d11 scp -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb /home/carlosjr/.ansible/tmp/ansible-local-99838qyeksos/tmptt_7p9ke '[mt417]:'"'"'syntax error (line 1 column 5)/AnsiballZ_routeros_command.py'"'"''
<mt398> SSH: EXEC sshpass -d13 scp -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a /home/carlosjr/.ansible/tmp/ansible-local-99838qyeksos/tmpco5ci1di '[mt398]:'"'"'syntax error (line 1 column 5)/AnsiballZ_routeros_command.py'"'"''
[WARNING]: scp transfer mechanism failed on [mt398]. Use ANSIBLE_DEBUG=1 to see detailed information
<mt398> ESTABLISH SSH CONNECTION FOR USER: admin
[WARNING]: scp transfer mechanism failed on [mt417]. Use ANSIBLE_DEBUG=1 to see detailed information
<mt417> ESTABLISH SSH CONNECTION FOR USER: admin
<mt398> SSH: EXEC sshpass -d13 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a mt398 'dd of=syntax error (line 1 column 5)/AnsiballZ_routeros_command.py bs=65536'
<mt417> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb mt417 'dd of=syntax error (line 1 column 5)/AnsiballZ_routeros_command.py bs=65536'
<mt398> (0, b'syntax error (line 1 column 37)\n', b'')
<mt398> (0, b'syntax error (line 1 column 37)\n', b'')
<mt398> ESTABLISH SSH CONNECTION FOR USER: admin
<mt417> (0, b'syntax error (line 1 column 37)\n', b'')
<mt417> (0, b'syntax error (line 1 column 37)\n', b'')
<mt398> SSH: EXEC sshpass -d13 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a mt398 '/bin/sh -c '"'"'chmod u+x '"'"'"'"'"'"'"'"'syntax error (line 1 column 5)/'"'"'"'"'"'"'"'"' '"'"'"'"'"'"'"'"'syntax error (line 1 column 5)/AnsiballZ_routeros_command.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<mt417> ESTABLISH SSH CONNECTION FOR USER: admin
<mt417> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb mt417 '/bin/sh -c '"'"'chmod u+x '"'"'"'"'"'"'"'"'syntax error (line 1 column 5)/'"'"'"'"'"'"'"'"' '"'"'"'"'"'"'"'"'syntax error (line 1 column 5)/AnsiballZ_routeros_command.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<mt398> (1, b'syntax error (line 1 column 5)\n', b'')
<mt398> Failed to connect to the host via ssh: 
<mt417> (1, b'syntax error (line 1 column 5)\n', b'')
<mt417> Failed to connect to the host via ssh: 
fatal: [mt398]: FAILED! => {
    "msg": "Failed to set execute bit on remote files (rc: 1, err: )"
}
fatal: [mt417]: FAILED! => {
    "msg": "Failed to set execute bit on remote files (rc: 1, err: )"
}

PLAY RECAP ***************************************************************************************************************************************************************************************************
mt398                      : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
mt417                      : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
This two Mikrotiks are same model ( RB2011UiAS - Current Firmware 6.47).
Any clues will be appreciated.
Thanks,
Carlos
 
tippenring
Member Candidate
Member Candidate
Posts: 280
Joined: Thu Oct 02, 2014 8:54 pm
Location: St Louis MO
Contact:

Re: Ansible playbook error

Wed Oct 14, 2020 9:52 pm

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: timeout value 10 seconds reached while trying to send command: /system resource print
It would appear perhaps that the SSH connection failed. If it connected via SSH, perhaps the CPU is spiking and not providing a response within 10 seconds. Watch the CPU, and try extending the timeout value to see if it makes a difference.
 
tippenring
Member Candidate
Member Candidate
Posts: 280
Joined: Thu Oct 02, 2014 8:54 pm
Location: St Louis MO
Contact:

Re: Ansible playbook error

Wed Oct 14, 2020 9:54 pm

<mt398> Failed to connect to the host via ssh:
<mt417> Failed to connect to the host via ssh:
Do you think the error messages are incorrect? If so, why do you think that?
 
ThePhenex
just joined
Topic Author
Posts: 2
Joined: Thu Aug 27, 2020 5:15 pm

Re: Ansible playbook error  [SOLVED]

Thu Oct 15, 2020 12:19 pm

Hello,

Have you found a way to solve your issue?

I have a similar here, using this playbook:
---
- hosts: routers
  gather_facts: false
  tasks:
    - name: Run command on remote devices
      community.network.routeros_command:
        commands: /system routerboard print

And got this output when debugging
carlosjr@jupiter:~/ansible$ ansible-playbook -vvv mt.yml -u admin -k
ansible-playbook 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/carlosjr/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
Using /etc/ansible/ansible.cfg as config file
SSH password: 
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: mt.yml *********************************************************************************************************************************************************************************************
1 plays in mt.yml

PLAY [routers] ***********************************************************************************************************************************************************************************************
META: ran handlers

TASK [Run command on remote devices] *************************************************************************************************************************************************************************
task path: /home/carlosjr/ansible/mt.yml:8
<mt417> ESTABLISH SSH CONNECTION FOR USER: admin
<mt417> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb mt417 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-$USER/ansible-tmp-1602529514.877012-224436382785902 `" && echo ansible-tmp-1602529514.877012-224436382785902="` echo /tmp/ansible-$USER/ansible-tmp-1602529514.877012-224436382785902 `" ) && sleep 0'"'"''
<mt398> ESTABLISH SSH CONNECTION FOR USER: admin
<mt398> SSH: EXEC sshpass -d13 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a mt398 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-$USER/ansible-tmp-1602529514.8817732-87555262573894 `" && echo ansible-tmp-1602529514.8817732-87555262573894="` echo /tmp/ansible-$USER/ansible-tmp-1602529514.8817732-87555262573894 `" ) && sleep 0'"'"''
<mt398> (0, b'syntax error (line 1 column 5)\n', b'')
<mt417> (0, b'syntax error (line 1 column 5)\n', b'')
<mt398> Attempting python interpreter discovery
<mt398> ESTABLISH SSH CONNECTION FOR USER: admin
<mt417> Attempting python interpreter discovery
<mt417> ESTABLISH SSH CONNECTION FOR USER: admin
<mt398> SSH: EXEC sshpass -d13 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a mt398 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<mt417> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb mt417 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<mt417> (0, b'syntax error (line 1 column 5)\n', b'')
<mt398> (1, b'syntax error (line 1 column 5)\n', b'')
Using module file /home/carlosjr/.ansible/collections/ansible_collections/community/network/plugins/modules/routeros_command.py
<mt398> Failed to connect to the host via ssh: 
<mt417> PUT /home/carlosjr/.ansible/tmp/ansible-local-99838qyeksos/tmptt_7p9ke TO syntax error (line 1 column 5)/AnsiballZ_routeros_command.py
<mt417> SSH: EXEC sshpass -d11 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb '[mt417]'
Using module file /home/carlosjr/.ansible/collections/ansible_collections/community/network/plugins/modules/routeros_command.py
<mt398> PUT /home/carlosjr/.ansible/tmp/ansible-local-99838qyeksos/tmpco5ci1di TO syntax error (line 1 column 5)/AnsiballZ_routeros_command.py
<mt398> SSH: EXEC sshpass -d13 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a '[mt398]'
[WARNING]: sftp transfer mechanism failed on [mt417]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: sftp transfer mechanism failed on [mt398]. Use ANSIBLE_DEBUG=1 to see detailed information
<mt417> SSH: EXEC sshpass -d11 scp -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb /home/carlosjr/.ansible/tmp/ansible-local-99838qyeksos/tmptt_7p9ke '[mt417]:'"'"'syntax error (line 1 column 5)/AnsiballZ_routeros_command.py'"'"''
<mt398> SSH: EXEC sshpass -d13 scp -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a /home/carlosjr/.ansible/tmp/ansible-local-99838qyeksos/tmpco5ci1di '[mt398]:'"'"'syntax error (line 1 column 5)/AnsiballZ_routeros_command.py'"'"''
[WARNING]: scp transfer mechanism failed on [mt398]. Use ANSIBLE_DEBUG=1 to see detailed information
<mt398> ESTABLISH SSH CONNECTION FOR USER: admin
[WARNING]: scp transfer mechanism failed on [mt417]. Use ANSIBLE_DEBUG=1 to see detailed information
<mt417> ESTABLISH SSH CONNECTION FOR USER: admin
<mt398> SSH: EXEC sshpass -d13 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a mt398 'dd of=syntax error (line 1 column 5)/AnsiballZ_routeros_command.py bs=65536'
<mt417> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb mt417 'dd of=syntax error (line 1 column 5)/AnsiballZ_routeros_command.py bs=65536'
<mt398> (0, b'syntax error (line 1 column 37)\n', b'')
<mt398> (0, b'syntax error (line 1 column 37)\n', b'')
<mt398> ESTABLISH SSH CONNECTION FOR USER: admin
<mt417> (0, b'syntax error (line 1 column 37)\n', b'')
<mt417> (0, b'syntax error (line 1 column 37)\n', b'')
<mt398> SSH: EXEC sshpass -d13 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/59c521426a mt398 '/bin/sh -c '"'"'chmod u+x '"'"'"'"'"'"'"'"'syntax error (line 1 column 5)/'"'"'"'"'"'"'"'"' '"'"'"'"'"'"'"'"'syntax error (line 1 column 5)/AnsiballZ_routeros_command.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<mt417> ESTABLISH SSH CONNECTION FOR USER: admin
<mt417> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/carlosjr/.ansible/cp/66853fc6eb mt417 '/bin/sh -c '"'"'chmod u+x '"'"'"'"'"'"'"'"'syntax error (line 1 column 5)/'"'"'"'"'"'"'"'"' '"'"'"'"'"'"'"'"'syntax error (line 1 column 5)/AnsiballZ_routeros_command.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<mt398> (1, b'syntax error (line 1 column 5)\n', b'')
<mt398> Failed to connect to the host via ssh: 
<mt417> (1, b'syntax error (line 1 column 5)\n', b'')
<mt417> Failed to connect to the host via ssh: 
fatal: [mt398]: FAILED! => {
    "msg": "Failed to set execute bit on remote files (rc: 1, err: )"
}
fatal: [mt417]: FAILED! => {
    "msg": "Failed to set execute bit on remote files (rc: 1, err: )"
}

PLAY RECAP ***************************************************************************************************************************************************************************************************
mt398                      : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
mt417                      : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
This two Mikrotiks are same model ( RB2011UiAS - Current Firmware 6.47).
Any clues will be appreciated.
Thanks,
Carlos
Yes, the problem that caused it was the lengh of the hostname on the mikrotik cpe itself. Due to the control path lengh limit of ansible, it cannot be longer then 31 chars. Changing the hostname fixed it.

Who is online

Users browsing this forum: Baidu [Spider] and 95 guests