Skip to content

Commit e0a90f8

Browse files
authored
Merge pull request #4 from hellt/send-file
added support for config snippets
2 parents 122a905 + 6210894 commit e0a90f8

File tree

9 files changed

+531
-214
lines changed

9 files changed

+531
-214
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.vscode
2+
.idea
23
outputs*
34
dist
45
cmdo

README.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
[![Github all releases](https://img.shields.io/github/downloads/hellt/cmdo/total.svg?style=flat-square&color=424f35&labelColor=bec8d2)](https://github.com/hellt/cmdo/releases/)
55
---
66

7-
Commando is a tiny tool that enables users to collect command outputs from a single or a multiple networking devices defined in an inventory file.
7+
Commando is a tiny tool that enables users
8+
* to collect command outputs from a single or a multiple networking devices defined in an inventory file
9+
* send file-based or string-based configs towards the devices defined in the inventory file
10+
11+
all that with zero dependencies and a 1-click installation.
812

913
[![asciicast](https://asciinema.org/a/417792.svg)](https://asciinema.org/a/417792)
1014

@@ -157,13 +161,50 @@ devices:
157161
address: string
158162
credentials: string # optional reference to the defined credentials
159163
transport: string # optional reference to the defined transport options
164+
send-commands-from-file: /path/to/file/with/show-commands.txt
160165
send-commands:
161-
- cmd1
162-
- cmd2
163-
- cmdN
166+
- cmd1
167+
- cmd2
168+
- cmdN
169+
send-configs-from-file: /path/to/file/with/config-commands.txt
170+
send-configs:
171+
- cmd1
172+
- cmdN
173+
cfg-operations:
174+
# Note: cfg operations currently supported only on: arista_eos, cisco_iosxe,
175+
# cisco_nxos, cisco_iosxr, juniper_junos
176+
- type: load-config
177+
replace: false
178+
diff: true
179+
commit: false
180+
# Note: there is also a "config-from-file" option to load configurations from a file
181+
config: "interface loopback1\ndescription tacocat"
182+
- type: get-config
183+
source: running
164184
```
165185

166-
`send-commands` list holds a list of commands which will be send towards a device. Check out the attached [example inventory](inventory.yml) file to a reference.
186+
`send-commands` list holds a list of non-configuration commands which will be send towards a device. A non configuration command is a command that doesn't require to have a configuration mode enabled on a device. A typical example is a `show <something>` command.
187+
Outputs from each command of a `send-commands` list will be saved/printed.
188+
189+
If you want to keep the commands in a separate file, then you can use `send-commands-from-file` element which takes a path to a said file. You can combine `send-commands` and `send-commands-from-file` in a single device.
190+
191+
In contrast with `send-commands*` options, it is possible to tell `commando` to send configuration commands. For that we have the following configuration elements:
192+
193+
* `send-configs` - takes a list of configuration commands and executes then without printing/saving any output the commands may return
194+
* `send-configs-from-file` - does the same, but the commands are kept in a file.
195+
196+
Entering in the config mode is handled by commando, so your config commands doesn't need to have any `conf t` or `configure private` commands. Just remember to add the `commit` command if your device needs it.
197+
198+
The order these options are processed in:
199+
200+
1. "cfg" operations
201+
2. send-configs-from-file
202+
3. send-configs
203+
4. send-commands-from-file
204+
5. send-commands
205+
206+
207+
Check out the attached [example inventory](inventory.yml) file for reference.
167208

168209
## Configuration options
169210

0 commit comments

Comments
 (0)