Ansible 2.3.0 Connecting to Cisco IOS router

I’m very new to Ansible. I have a small lab running and I’m trying to evaluate the use of Ansible for making network changes. I have a workstations running CentOS Linux release 7.3.1611 and Ansible 2.3.0 as a fresh install. I’m using a cisco 819 router running Cisco IOS Software, C800 Software (C800-UNIVERSALK9-M), Version 15.3(3)M.3. I can SSH from the workstation to the router from the work station and via putty on a windows 10 machine but when I try a connection test I get the following:

[pat@new-host-8 ~]$ansible all -m ping
192.168.1.142 | UNREACHABLE! => {
“changed”: false,
“msg”: “Failed to connect to the host via ssh: Connection closed\r\n”,
“unreachable”: true
}

I’ve run multiple debugs. Can anyone make a suggestion on what the issue might be? I’ve done some research and have run a number of raw commands as well as a small playbook it appears to not be an SSH error but an issue within an Ansible module with sleep 0 command…

Regards

Pat

Testing SSH terminal session from Ansible host system to the router

[pat@new-host-8 ~]$ ssh 192.168.1.142 -l pat

819#

To run ansible on remote host the host need to support Python.
When using the ping module Ansible creates a little Python script that is copied to the remote and then runs the python script on the remote host.
But network equipment typically doesn't support Python.

Ansible has support for Cisco, the iso_* modules.
These modules are running on the Ansible control machine and do a ssh to the Cisco and runs the appropriate commands on the cli.

You need to mention connection type local for network devices.

---
- hosts: lab
  connection: local

The credentials to connect to remote network device can be mentioned either in playbook within a provider or in host inventory file.

Regards,
Ganesh