Fortinet white logo
Fortinet white logo

Jinja CLI templates

Jinja CLI templates

Following is a summary of the tasks to complete in Device Manager:

  1. Import Jinja CLI templates. See Importing Jinja CLI templates.
  2. Create CLI template groups. See Creating CLI template groups.
  3. Assign CLI template groups to device groups. See Assigning CLI template groups.

Importing Jinja CLI templates

Import the Project template file first, and then import the remaining templates. The Project template file is imported first because all the other templates use it, so the Project template file must exist in FortiManager before we import the other templates.

When you import CLI templates that use meta fields, FortiManager prompts you to create the meta fields.

To import Jinja CLI templates:
  1. In Device Manager, go to Provisioning Templates > CLI Templates.
  2. From the More menu, select Import.

  3. Drag and drop the Project template file on the Import CLI Template pane.

    Note

    Ensure that you import the Project template file first. Because all the other templates use the Project template, it must exist in FortiManager before you import the other templates.

  4. Set Script Type to Jinja Script, and click Import:

    FortiManager automatically suggests that you create all the necessary meta fields.

  5. Create the necessary meta fields. Ensure that you create them all as optional Device meta fields:

  6. Click Import again. The import succeeds.
  7. Import all the other templates in our set.

    Pay special attention to the pre-run CLI templates because they must be marked explicitly.

    It is also important to set Script Type to Jinja Script for all the files:

  8. FortiManager will suggest creating additional meta fields (including profile and region).

    As before, make sure to create them all as optional Device meta fields:

  9. Click Import again, and make sure the import succeeds.

Creating CLI template groups

To create CLI template groups:
  1. On the Provisioning Templates > CLI Templates pane, click Create New > CLI Template Group, and create two template groups named Edge-Template and Hub-Template:

    For example, create the Edge-Template group, and select the following members:

    • 01-Edge-Underlay
    • 02-Edge-Overlay
    • 03-Edge-Routing

    For example, create the Hub-Template group, and select the following members

    • 01-Hub-Underlay
    • 02-Hub-Overlay
    • 03-Hub-Routing
    • 04-Hub-MultiRegion

Assigning CLI template groups

The generic CLI template groups will be applied to all types of sites.

To assign CLI template groups:
  1. On the Provisioning Templates > CLI Templates pane, click Assign to Device/Group to assign the CLI template groups to the device groups named Edge and Hubs respectively:

Jinja CLI templates

Jinja CLI templates

Following is a summary of the tasks to complete in Device Manager:

  1. Import Jinja CLI templates. See Importing Jinja CLI templates.
  2. Create CLI template groups. See Creating CLI template groups.
  3. Assign CLI template groups to device groups. See Assigning CLI template groups.

Importing Jinja CLI templates

Import the Project template file first, and then import the remaining templates. The Project template file is imported first because all the other templates use it, so the Project template file must exist in FortiManager before we import the other templates.

When you import CLI templates that use meta fields, FortiManager prompts you to create the meta fields.

To import Jinja CLI templates:
  1. In Device Manager, go to Provisioning Templates > CLI Templates.
  2. From the More menu, select Import.

  3. Drag and drop the Project template file on the Import CLI Template pane.

    Note

    Ensure that you import the Project template file first. Because all the other templates use the Project template, it must exist in FortiManager before you import the other templates.

  4. Set Script Type to Jinja Script, and click Import:

    FortiManager automatically suggests that you create all the necessary meta fields.

  5. Create the necessary meta fields. Ensure that you create them all as optional Device meta fields:

  6. Click Import again. The import succeeds.
  7. Import all the other templates in our set.

    Pay special attention to the pre-run CLI templates because they must be marked explicitly.

    It is also important to set Script Type to Jinja Script for all the files:

  8. FortiManager will suggest creating additional meta fields (including profile and region).

    As before, make sure to create them all as optional Device meta fields:

  9. Click Import again, and make sure the import succeeds.

Creating CLI template groups

To create CLI template groups:
  1. On the Provisioning Templates > CLI Templates pane, click Create New > CLI Template Group, and create two template groups named Edge-Template and Hub-Template:

    For example, create the Edge-Template group, and select the following members:

    • 01-Edge-Underlay
    • 02-Edge-Overlay
    • 03-Edge-Routing

    For example, create the Hub-Template group, and select the following members

    • 01-Hub-Underlay
    • 02-Hub-Overlay
    • 03-Hub-Routing
    • 04-Hub-MultiRegion

Assigning CLI template groups

The generic CLI template groups will be applied to all types of sites.

To assign CLI template groups:
  1. On the Provisioning Templates > CLI Templates pane, click Assign to Device/Group to assign the CLI template groups to the device groups named Edge and Hubs respectively: