Inventory Template (Traditional Host Group)
Example: Inventory Template (Traditional 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
var1: $input_vars.external_var1 # external_var1 is passed from outside (e.g. Intent/Runbook template variable)
- 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 (Traditional Host Group)
To suit your specific project needs, you can either modify the existing key/value pair(s) or add a 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