ADOM-level meta variables for general use in scripts, templates, and model devices
In FortiManager, ADOM-level meta variables are available for general use in scripts, templates, and model devices.
To create and use an ADOM-level metadata variable:
- In FortiManager, enter the ADOM where the metadata variable will be used.
- Enable the metadata variable object type in Policy & Objects.
- Go to Policy & Objects, click Tools in the toolbar, and select Display Options.
- Enable the Metadata Variables object under the Advanced category, and click OK.
In FortiManager 7.2.2 and later, Display Options has been renamed to Feature Visibility.
- Go to Policy & Objects, click Tools in the toolbar, and select Display Options.
- Create the metadata variable object.
- In Policy & Objects, go to Object Configurations > Advanced > Metadata Variables, and click Create New.
The Create New Metadata Variables wizard opens. - Enter the required information to create the metadata variable.
In this example, the following metadata information is used:- Name: hostname
- Default Value: fgt-vm64
- Per-Device Mapping: ON
- Click OK to save your changes.
- In Policy & Objects, go to Object Configurations > Advanced > Metadata Variables, and click Create New.
- Create a CLI template that includes the metadata variable.
- Go to Device Manager > Provisioning Templates > CLI Templates, and click Create New > Post-Run CLI Template.
The Create Post-Run CLI Template wizard opens. - Enter the script details, including the metavariable, and click OK.
In this example, the following CLI is used that includes the hostname metadata variable:config system global
set hostname $(hostname)
end
- Go to Device Manager > Provisioning Templates > CLI Templates, and click Create New > Post-Run CLI Template.
- Install the CLI template to a device.
- Go to Device Manager and assign the template to a model device or an online FortiGate device.
- Perform an installation using the Install Wizard to install device settings.
In this example, the CLI template is assigned and installed to FortiGate "vlan171_0072". When an installation is performed, the install preview shows that the variable (hostname) has been substituted as per its per-device value "Branch0072".