Can network_cli or expect run tasks via SSH on simple embedded devices?

266 views
Skip to first unread message

CodeWaffle

unread,
Feb 25, 2019, 11:30:04 AM2/25/19
to ansible...@googlegroups.com
Hi all:

Not sure if I'm going about this the right way since I'm pretty new to Ansible.

Bu, can something like "network_cli" be used to drive simple to simple embedded devices over SSH in an expect-like manner?  

I've got a few devices that don't have a custom network_os or custom Ansible module defined.  They also don't have a full shell and just expose a simple command-line REPL. 

Some simple pxssh script might work too, but it would seem nice to expose these steps as first-class Ansible tasks too.

If this is doable via Ansible in a nice manner, can someone point me to the docs that cover this kind of use case?

Thank you!

Ganesh Nalawade

unread,
Feb 27, 2019, 12:51:45 AM2/27/19
to Ansible Project

"network_cli" connection plugin creates a pseudo terminal on the control node which establishes ssh connection with target host. 
So ideally it can be used to talk to any SSH-based target host. network_cli connection plugin relies on value of ansible_network_os
config variable to load the appropriate terminal and cliconf plugin for the target host.

CodeWaffle

unread,
Feb 27, 2019, 7:32:03 PM2/27/19
to ansible...@googlegroups.com
Hi Ganesh:

I have indeed seen the docs you point to below, but the next question remains:  What is the correct value for "ansible_network_os"?



The docs seems to list only real gear like Cisco, etc.  Is there some base or generic option to choose?   A quick look at the source code did not seem to indicate anything obvious either.

Thank you!

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

Ganesh Nalawade

unread,
Feb 28, 2019, 1:29:28 AM2/28/19
to Ansible Project

The value depends on the name of the new terminal/cliconf plugin file added to support the new OS.
So if the plugin file name is 'foo.py' the value of ansible_network_os should be 'foo'.

The ansible_network_os value is used to load the right terminal
Reply all
Reply to author
Forward
0 new messages