Variables & Extraction
Define and manage template variables.
Variable Types
| Type | Description | Example Value |
|---|---|---|
| String | Text value | "Router-01" |
| Number | Integer or decimal | 100 |
| Boolean | True/false | true |
| List | Array of values | ["10.0.0.1", "10.0.0.2"] |
| Object | Key-value pairs | {"name": "vlan10", "id": 10} |
Auto-Extraction
NetStacks automatically detects variables in your templates by parsing Jinja2 expressions. Variables appear in the sidebar for configuration.
{# Template content #}
hostname {{ hostname }}
ip name-server {{ dns_primary }}
ip name-server {{ dns_secondary }}
{# Auto-extracted variables:
- hostname (string)
- dns_primary (string)
- dns_secondary (string)
#}Variable Sources
Variables can be populated from multiple sources:
- Manual Entry - User enters values at deployment
- Device Attributes - Pull from device metadata
- API Resources - Fetch from external APIs
- Stack Defaults - Inherit from stack template
- Override - Per-device overrides