A go language tool to work with SSH to cisco devices.
It allows to collect the output of commands directly, without logging in. It can cache passwords.
go install github.com/cdevr/cpush/cmd/cpush@latest
cpush --device ip-rtr-ch-1 --cmd 'show version'
You can also pass parameters just directly if just specifying device and command:
cpush ip-rtr-ch-1 show version
It also supports just giving you an interactive session on this router:
cpush --device ip-rtr-ch-1 -i
Or the shortcut:
cpush ip-rtr-ch-1
In this case, cpush will interpret the first argument as the router name, and subsequent arguments will be used to send a command.
List a bunch of devices in a file called "devices_shver". For example router1 and router2
# cat devices_shver
router1
router2
# cpush --device file:devices_shver --cmd "show version" --output "shver_%s"
# ls
devices_shver
shver_router1
shver_router2
#
This will create the files "shver_router1" and "shver_router2" that contain the output of the listed devices.
Cpush has special logic to get close to atomic application of configuration pushes.
cpush --device ip-rtr-1 --push 'int lo 99; ip addr 1.0.0.1 255.255.255.0'
This repository uses git hooks. Please configure the git repository to actually use them.
git config core.hooksPath .githooks