Inventory template is a feature designed for bulk inventory instance (such as host group) generation. Inventory template can be defined by using customized variables provided by NetBrain. For example, a variable can be defined as: interface = $interface. _visible_ interface, and $interface._visible_interface is the variable provided by NetBrain.

Define an inventory template in the text field and click Translate Inventory, then multiple hosts will be generated in the Inventory Instance field accordingly. After the inventory instance is generated, users will still be able to modify the parameters in the Inventory Instance editor based on their specific project needs.

Two types of inventory templates and their corresponding inventory instances are provided as follows:

Inventory Template (Legacy Host Group)

Inventory Template (SDN Host Group)

Inventory Template (Legacy Host Group)

Example: Inventory Template (Legacy Host Group)

Replace the highlighted content with the specific parameters to customize your template.

---
global_variables:
    ansible_connection: network_cli
host_groups:
    - name: ungrouped # ansible default host group "ungrouped", for all hosts that are not in any other host groups
    group_variables:
         ansible_network_os: ios
         ansible_become: yes
         ansible_become_method: enable
         descr: "in ungrouped group"
    host_variables:
         ansible_ssh_user: $credential.username
         ansible_ssh_pass: $credential.password
         vendor: $device.vendor
    - name: cisco_router # auto-generated, defined from UI
    group_variables:
         ansible_network_os: ios
         ansible_become: yes
         ansible_become_method: enable
         descr: "cisco_router group"
    host_variables:
         ansible_ssh_user: $credential.username
         ansible_ssh_pass: $credential.password
         vendor: $device.vendor
         visible_intf: $interface._visible
         mgmt_intf: $device.management_interface
         all_intf: $interface._all
    - name: cisco_switch # auto-generated, defined from UI
    group_variables:
         ansible_network_os: ios
         ansible_become: yes
         ansible_become_method: enable
    host_variables:
         ansible_ssh_user: $credential.username
         ansible_ssh_pass: $credential.password
         vendor: $device.vendor
         model: $device.model

The following table lists the description of the main parameters.

Parameter

Description

global_variables

Variables of Ansible default group “all”, which will be applied to all hosts.

Note: Global variables should be constants. NetBrain Intellisense Variables are not supported.

name

The name of the host group, which is auto-generated and defined from UI. See Define a Legacy Host Group for more details.

Note: Make sure to add a leading hyphen ‘-‘ when defining each host group name, as it indicates the following data structure is an array/list in Yaml syntax.

Note: Any unspecified host groups will be assigned to the default Ansible host group ungrouped. See Ansible default groups for more information.

group_variables

The variables of the host group. See Ansible group variables for more information.

Note: Group variables should be constants. NetBrain Intellisense Variables are not supported.

host_variables

The variables of the host. Click Ansible host variables for more information.

Note: Values of host variables need to match the host's GDR properties or interfaces.

Note: ‘$’ can be used to trigger NetBrain Intellisense Variables.

Example: Inventory Instance (Legacy Host Group)

To suit your specific project needs, you can either modify the existing key/value pair(s) or add new key (such as ansible_connection)/value (such as network_cli) pair(s) in the inventory instance. All sensitive data in the Inventory Instance is encrypted.

Note: Make sure to replace the entire string when modifying the encrypted string *value_encrypted_donot_change*.

[all:vars]
ansible_connection=network_cli
 
[ungrouped]
192.168.180.105 ansible_ssh_user=root ansible_ssh_pass=Netbrain1 vendor=Juniper 
192.168.180.106 ansible_ssh_user=root
ansible_ssh_pass=*value_encrypted_donot_change* vendor=Juniper
 
[ungrouped:vars]
ansible_network_os=ios
ansible_become=yes
ansible_become_method=enable
descr="in ungrouped group"
 
[cisco_router]
 
192.168.180.101 ansible_ssh_user=*value_encrypted_donot_change* vendor=Cisco
visible_intf='["GigabitEthernet0/2","GigabitEthernet0/0"]' mgmt_intf=GigabitEthernet0/0
all_intf='["GigabitEthernet0/0","GigabitEthernet0/1"]'
ansible_ssh_private_key_file=*value_encrypted_donot_change*
 
192.168.180.107 ansible_ssh_user=*value_encrypted_donot_change* vendor=Cisco
visible_intf='["GigabitEthernet0/0"]' mgmt_intf=GigabitEthernet0/0
all_intf='["GigabitEthernet0/0","GigabitEthernet0/1"]'
ansible_ssh_private_key_file=*value_encrypted_donot_change*
 
[cisco_router:vars]
ansible_network_os=ios
ansible_become=yes
ansible_become_method=enable
descr="cisco_router group"
 
[cisco_switch]
192.168.180.103 ansible_ssh_pass=*value_encrypted_donot_change* vendor=Cisco model=IOSv 
192.168.180.104 ansible_ssh_user=*value_encrypted_donot_change*
ansible_ssh_pass=*value_encrypted_donot_change* vendor=Cisco model=IOSv
 
[cisco_switch:vars]
ansible_network_os=ios
ansible_become=yes
ansible_become_method=enable

 

Inventory Template (SDN Host Group)

Example: Inventory Template (SDN Host Group)

Replace the highlighted content with the specific parameters to customize your template.

---
global_variables: 
    ansible_connection: local
host_groups:
    - name: CISCO_ACI # to be manually modified by user
      group_variables:
       descr: "Group CISCO ACI"
      hosts: # use NetBrain Intellisense Variables here to define SDN controllers as hosts
       - $sdn_controller.APIC_1
       - $sdn_controller.APIC_2
      host_variables:
       username: $credential.username
       password: $credential.password

The following table lists the description of the main parameters.

Parameter

Description

global_variables

The variables of Ansible default group “all”, which will be applied to all hosts.

Note: Global variables should be constants. NetBrain Intellisense Variables are not supported.

name

The name of the host group, which is auto-generated and defined from UI. See Define a Legacy Host Group for more details.

Note: Any unspecified host groups will be assigned to the default Ansible host group ungrouped.

group_variables

The variables of the host group. See Ansible group variables for more information.

Note: Global variables should be constants. NetBrain Intellisense Variables are not supported.

hosts

The name of SDN Controller.

Note: Make sure to add a leading hyphen ‘-‘ when defining each host, as it indicates the following data structure is an array/list in YAML syntax.

host_variables

The variables of the host. See Ansible host variables for more information.

Note: Values of host variables need to match the host's GDR properties or interfaces.

Note: ‘$’ can be used to trigger NetBrain Intellisense Variables.

Example: Inventory Instance (SDN Host Group)

To suit your specific project needs, you can either modify the existing or add new key/value pair(s) in the inventory instance. All sensitive data in the Inventory Instance is encrypted.

Note: Make sure to replace the entire string when modifying the encrypted string *value_encrypted_donot_change*.

[CISCO_ACI]
192.168.48.211 username=admin password=*value_encrypted_donot_change* 
192.168.48.135 username=root password=*value_encrypted_donot_change* 
[CISCO_ACI:vars]
descr="Group CISCO ACI"