Link Search Menu Expand Document (external link)


YAML Structure


  • Each YAML document contains a Task
    • Each task contains sub-Tasks
      • Each sub-Task contains number of functions like execute, take_config_backup etc.

Create a new Task

Task:
  name: New Task
  log_format: markdown
  subTask:
    - name: Love forever
      vendor: cisco
      parallel: false

Task

InputTypeDescriptionOptionsDefault
task_log_formatStringTask log file formatmarkdown, txtmarkdown
task_nameStringThe name of the task (which will be displayed when listing tasks)  
Task.subTaskListList of subtasks (will be executed in order)  
Task.subTask.nameStringName of sub-task  
Task.subTask.vendorStringDefault Vendor for the sub-taskcisco, huaweicisco
Task.subTask.parallelBoolanWheather to execute the sub-task on the devices in Parallel, Currently not supported, will be supported in an upcoming releaseTrue, FalseFalse
     

Task.subTask.authenticate

Task:
  name: New Task
  log_format: markdown
  subTask:
    - name: Love forever
      vendor: cisco
      parallel: false
      authenticate:
        group: switches
        port: 22
        username:
          value_from_env:
            key: my_username
        password:
          value_from_env:
            key: my_password
        privileged_mode_password:
          value_from_env:
            key: my_password
        reconnect: True
InputTypeDescriptionOptionsDefault
groupStringInventory group to authenticate  
portInteger  22
usernamedctUsername for authentication  
passworddctPassword for authentication  
privileged_mode_passworddctPassword of the Privileged mode (eg. enable in Cisco & super in Huawei) [ If Provided, the device login to privileged_mode after authentication. ]  
reconnectBoolanWheather to reconnect if the SSH connection is interuptedTrue, FalseFalse
     

For options with dct type

Provide value directly

username:
  value: Trump

Provide value from ENV

username:
  value_from_env:
    key: my_username
  • Providing values from Secret managers like Vault & Cyberark, will be considered in 0.4.0 release

Task.subTask.configBackup

Task:
  name: New Task
  log_format: markdown
  subTask:
    - name: Love forever
      vendor: cisco
      parallel: false
      authenticate:
        group: switches
        port: 22
        username:
          value_from_env:
            key: my_username
        password:
          value_from_env:
            key: my_password
        privileged_mode_password:
          value_from_env:
            key: my_password
        reconnect: True
      configBackup:
        comment: "Test backup"
        exit_on_fail: True
        target: local
        skip:
          - 192.168.1.11
          - 192.168.1.12
InputTypeDescriptionOptionsDefault
commentStringComment describes the backup reason  
exit_on_failBoolean True, FalseTrue
targetStringWhere to save the backuplocal, s3local
skipListList of hosts to skip  
OnlyOnListList of hosts to backup and ignore others  

Task.subTask.commands

Task:
  name: New Task
  log_format: markdown
  subTask:
    - name: Love forever
      vendor: cisco
      parallel: false
      authenticate:
        group: switches
        port: 22
        username:
          value_from_env:
            key: my_username
        password:
          value_from_env:
            key: my_password
        privileged_mode_password:
          value_from_env:
            key: my_password
        reconnect: True
      configBackup:
        comment: "Test backup"
        exit_on_fail: True
        target: local
        skip:
          - 192.168.1.11
          - 192.168.1.12
      commands:
        - command: show ip int br
          tag: show1
          ask_for_confirmation: false
          exit_on_fail: false
          onlyOn:
            - 90.84.41.239            
        - command: |
            show vlan br
            show version
          when:
            tag: show1
            operator: is
            exit_code: 0
InputTypeDescriptionOptionsDefault
commandsListList of commands to execute (In order)  

Command options

InputTypeDescriptionOptionsDefault
commandStringCommand to execute  
tagStringA tag given to the command, allows us to refer to this commnd in other commands conditions  
ask_for_confirmationBooleanIf True, I will ask for confirmation before executing the command, Default: False  
exit_on_failBooleanIf True, the script will exit if the command exit with an Error, Default: TrueTrue, FalseTrue
onlyOnListA condition (List of hosts to execute only on)  
skipListA condition (List of hosts to Skip execution on)  
whendcta condition that determins whether the command will be executed or not (based on another command output)  

when options

InputTypeDescriptionOptionsDefault
tagStringthe tag of the previously executed command  
operatorString is, is_not 
exit_codeIntegerExit code of the condition command0, 1, -1