I have been redirected from git hub issue list to here. Could someone 
please take a look and suggest:

I am trying to work on a scenario in which I want to access Cisco and 
Juniper network devices and run my ansible network modules like get facts, 
get config, push config commands on them through ansible. The network 
devices are connected via console ports to an Avocent AS6000 server. So 
from a CentOS machine which is my ansible host machine, I want to login to 
the Avocent Server and then access the network devices using ansible 
playbooks. I am not sure how to go about it. Can anyone please guide me. I 
am new to this and sorry if i have posted in the wrong forum.
Please note: I am able to run playbooks directly through management port of 
the Network devices. This serial console route is a second way to access 
the devices and need to write playbooks in case the management IP goes down 
or is inaccessible.

COMPONENT NAME
Network Modules

ANSIBLE VERSION
ansible --version
ansible 2.3.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 
(Red Hat 4.8.5-11)]
`
OS / ENVIRONMENT
Centos7
Avocent Server ACS6000
Juniper EX2200

SUMMARY
Could someone please guide on how do I use ansible to login from my CentOS 
machine to an Avocent server and then navigate to different network devices 
that are connected serially on each port and run playbooks on it. Both 
CentOS and Avocent server is on the same network. I am able to ssh to the 
avocent device, but how do I access the network devices from it.

Manual steps to access:

   1. Login to avocent server via ssh through putty.
   2. Go to cli mode. by typing cli command
   3. Go to a particular folder which gives the port list of all the 
   connected devices. The port number corresponds to each device connected 
   serially to it

Also, here is the playbook to check ssh connectivity:

   - 
   
   hosts: avocent
   gather_facts: no
   connection: local
   
   tasks:
   - 
      
      name: Check SSH CONNECTIVITY
      tags: push
      wait_for: host={{ansible_host}} port=22 timeout=5
      - 
      
      name: print results
      debug: var=result
      
``
ACTUAL RESULTS
ok: [avocentfirst] => {
"changed": false,
"elapsed": 0,
"invocation": {
"module_args": {
"active_connection_states": [
"ESTABLISHED",
"SYN_SENT",
"SYN_RECV",
"FIN_WAIT1",
"FIN_WAIT2",
"TIME_WAIT"
],
"connect_timeout": 5,
"delay": 0,
"exclude_hosts": null,
"host": "xx.xx.xx.xx",
"path": null,
"port": 22,
"search_regex": null,
"sleep": 1,
"state": "started",
"timeout": 5
}
},
"path": null,
"port": 22,
"search_regex": null,
"state": "started"
}

Below is the failure message when I try to acess the network device:
Failure message:

"msg": "unable to connect to xx.xx.xx.x..: ConnectError(host: xx.xx.xx.xx, msg: 
Unexpected session close\


On Monday, September 18, 2017 at 1:13:18 PM UTC-5, Mini wrote:
>
> Hi, I am trying to work on a scenario in which I want to access Cisco and 
> Juniper network devices and run my ansible network modules like get facts, 
> get config, push config commands on them through ansible. The network 
> devices are connected via console ports to an Avocent AS6000 server. So 
> from a CentOS machine, i want to login to the Avocent Server and then 
> access the network device using ansible. I am not sure how to go about it. 
> Can anyone please guide me. I am new to this and sorry if i have posted in 
> the wrong forum.
> Please note: I am able to run playbooks directly through management port 
> of the Network devices. This serial console route is a second way to access 
> the devices and need to write playbooks in case the management IP goes down 
> or is inaccessible.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0df41419-c5f7-47b7-9b08-2e35ca91bca5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to