Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nmake/ansible-connect
Send commands to a single network device and return the output.
https://github.com/nmake/ansible-connect
Last synced: about 2 months ago
JSON representation
Send commands to a single network device and return the output.
- Host: GitHub
- URL: https://github.com/nmake/ansible-connect
- Owner: nmake
- License: gpl-3.0
- Created: 2019-05-30T18:56:46.000Z (over 5 years ago)
- Default Branch: devel
- Last Pushed: 2021-09-23T23:37:09.000Z (over 3 years ago)
- Last Synced: 2023-08-04T20:06:17.871Z (over 1 year ago)
- Language: Python
- Size: 53.7 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ansible-connect
This project provides a direcl way to consume the `network_cli` connection
plugin that ships with Ansible. It provides a command line executable for
sending a command to a remote device and returning its output.This script has been tested to work with Ansible 2.8 or later and Python 3.6
This script is made available for free as-is for testing only and is not
maintaned or supported## Example usage
```
$ ansible-connect --help
usage: ansible-connect [-h] [-p PORT] [-u USERNAME] [-P PASSWORD] [-t TIMEOUT]
[-n NETWORK_OS] [--json]
[command [command ...]] hostpositional arguments:
command Command(s) to send to the remote device
host Hostname or IP address of the remote hostoptional arguments:
-h, --help show this help message and exit
-p PORT, --port PORT The SSH port to connect the to (default=22)
-u USERNAME, --username USERNAME
The username used to authenticate with
-P PASSWORD, --password PASSWORD
The password used to authenticate with
-t TIMEOUT, --timeout TIMEOUT
The timeout value for the connection (default=30)
-n NETWORK_OS, --network-os NETWORK_OS
The network-os plugin to load
--json Return the output as a JSON$ ansible-connect -u bob -n vyos "show config" vyos101
Password:interfaces {
ethernet eth0 {
address dhcp
hw-id 52:54:00:eb:f9:25
smp-affinity auto
}
loopback lo {
}
}
service {
lldp {
}
ssh {
}
}
system {
config-management {
commit-revisions 100
}
console {
device ttyS0 {
speed 9600
}
}
host-name vyos101
login {
user vyos {
authentication {
encrypted-password ****************
plaintext-password ****************
}
level admin
}
}
ntp {
server 0.pool.ntp.org {
}
server 1.pool.ntp.org {
}
server 2.pool.ntp.org {
}
}
syslog {
global {
facility all {
level info
}
facility protocols {
level debug
}
}
}
time-zone UTC
}```