Ansible Raw module

I want to configure Ansible for Mikrotik deployments. Use Raw module.

Ssh connection from Ansible server is ok.

My playbook is:

- name: Run show commands on Mikrotiks
  hosts: testMikrotiks
  remote_user: testuser
  gather_facts: false
  connection: local

  tasks:

    - name: "run ip arp print"
      raw: "ip arp print"
      register: ip_arp_print_result

    - name: Debug registered var
      debug: var=ip_arp_print_result.stdout_lines

But Mikrotik returns an error:

PLAY [Run show commands on Mikrotiks] ***************************************************************************************************************************************************

TASK [run ip arp print] *****************************************************************************************************************************************************************
fatal: [10.1.1.2]: FAILED! => {"changed": true, "msg": "non-zero return code", "rc": 1, "stderr": "Object \"arp\" is unknown, try \"ip help\".\n", "stdout": "", "stdout_lines": []}
fatal: [10.1.1.3]: FAILED! => {"changed": true, "msg": "non-zero return code", "rc": 1, "stderr": "Object \"arp\" is unknown, try \"ip help\".\n", "stdout": "", "stdout_lines": []}
        to retry, use: --limit @/etc/ansible/pb001.retry

PLAY RECAP ******************************************************************************************************************************************************************************
10.1.1.2              : ok=0    changed=0    unreachable=0    failed=1
10.1.1.3              : ok=0    changed=0    unreachable=0    failed=1

How to fix it?
To execute arbitrary commands on Mikrotik.

From other side this playbook works fine with Cisco Catalyst.
But without option “connection: local”.

In other tests i use Ad-Hoc commands.
With Cisco Catalyst i get feedback without any problem.

[root]# ansible testCatalyst -i myhosts -m raw -a "sh ip int br | ex unassigned" -u admin --ask-pass
SSH password:
10.1.1.3 | SUCCESS | rc=0 >>

Interface              IP-Address      OK? Method Status                Protocol
Vlan345                10.1.1.3   YES NVRAM  up                    up
Shared connection to 10.1.1.3 closed.


10.1.1.2 | SUCCESS | rc=0 >>

Interface              IP-Address      OK? Method Status                Protocol
Vlan345                10.1.1.2   YES NVRAM  up                    up
Shared connection to 10.1.1.2 closed.

And with Mikrotik not.
It hangs.

[root]# ansible testMikrotiks -i myhosts -m raw -a "ip arp print" -u admin --ask-pass
SSH password:
^CProcess WorkerProcess-2:
Process WorkerProcess-1:
Traceback (most recent call last):
Traceback (most recent call last):
  File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
  File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
    self.run()
  File "/usr/lib/python2.7/site-packages/ansible/executor/process/worker.py", line 118, in run
  File "/usr/lib/python2.7/site-packages/ansible/executor/process/worker.py", line 118, in run
    self._rslt_q
    self._rslt_q
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 138, in run
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 138, in run
 [ERROR]: User interrupted execution

At runtime i see user connection on Mikrotik.

Do i need to edit ssh connection options?
Does anybody has this configuration?

Most likely is related to the SSH response of the Mikrotik..
Did you investigate the Ansible module for Mikrotik already?

https://github.com/CFSworks/ansible-routeros
https://github.com/zahodi/ansible-mikrotik

Interesting, available from ansible 2.7
https://docs.ansible.com/ansible/latest/modules/routeros_command_module.html