connpy/automation-template.yaml
Federico Luzzi 00905575fc Fix:
- Fix not allowing to use some regex symbols when passing arguments.
    - Fix AI requests timing out when list of nodes is big.
    - Fix error when forwarding connpy run commands to a file

Features:
    - Improve AI response time changing list of devices to list of OS,
      reducing the lenght of request.
    - Update GPT model to last one.
    - Add filtering option to list command, Also format can be passed to
      format the output as needed.
    - Allow to use regular expresions to match nodes in: run command
      (using yaml file or directly), remove command.
    - When there is a connectivity error, now it shows the error number
      plus the protocol error.
2023-10-26 17:33:44 -03:00

72 lines
1.8 KiB
YAML

---
tasks:
- name: "Config"
action: 'run' #Action can be test or run. Mandatory
nodes: #List of nodes to work on. Mandatory
- 'router1@office' #You can add specific nodes
- '@aws' #entire folders or subfolders
- '@office': #filter inside a folder or subfolder
- 'router2'
- 'router7'
- 'router[0-9]' # Or use regular expressions
commands: #List of commands to send, use {name} to pass variables
- 'term len 0'
- 'conf t'
- 'interface {if}'
- 'ip address 10.100.100.{id} 255.255.255.255'
- '{commit}'
- 'end'
variables: #Variables to use on commands and expected. Optional
__global__: #Global variables to use on all nodes, fallback if missing in the node.
commit: ''
if: 'loopback100'
router1@office:
id: 1
router2@office:
id: 2
commit: 'commit'
router3@office:
id: 3
vrouter1@aws:
id: 4
vrouterN@aws:
id: 5
output: /home/user/logs #Type of output, if null you only get Connection and test result. Choices are: null,stdout,/path/to/folder. Folder path only works on 'run' action.
options:
prompt: r'>$|#$|\$$|>.$|#.$|\$.$' #Optional prompt to check on your devices, default should work on most devices.
parallel: 10 #Optional number of nodes to run commands on parallel. Default 10.
timeout: 20 #Optional time to wait in seconds for prompt, expected or EOF. Default 20.
- name: "TestConfig"
action: 'test'
nodes:
- 'router1@office'
- '@aws'
- '@office':
- 'router2'
- 'router7'
commands:
- 'ping 10.100.100.{id}'
expected: '!' #Expected text to find when running test action. Mandatory for 'test'
variables:
router1@office:
id: 1
router2@office:
id: 2
commit: 'commit'
router3@office:
id: 3
vrouter1@aws:
id: 4
vrouterN@aws:
id: 5
output: null
...