Inventory

Concept

Inventories are databases for playbook’s target execution. One or more is given to targets to gather variables on target’s executions context. This inventory can be used by both playbook method :

Hint

Database use CSV structure to offer Microsoft Excel or other spreadsheet good compatibilities.

CSV format

  • First column must be header row

  • Use semicolons separator

  • Must be UTF-8

  • If your CSV column include the separator ; add quotes to your entry

Header row

The header row must be present and contains declaration of all variables that will be available for target resolution.

Column index

Title

Type

Description

0

source

An itemId

The source of the template

1

destination

An itemId

The destination on witch the source will by “copy/pasted”

2

rule

An path relative to the git templates/rules/fribourg.items-render-rules

The rule to apply Evaluation rules

3+

Defined by keyword

See csv column keyword

Advanced usage specified by column name.

Usage

Here is an example of a simple CSV database :

source;destination;rule;variable-dashboardName
templates.sources.example-1;root.fribourg;;Fribourg
templates.sources.example-1;root.lausanne;;Lausanne

Variable definition:

An inventory contain all variables definitions that will be added in top level of generated file. They are defined by a prefix Two kind of variables are available using reserved keyword:

Keyword

Usage

variable-

A column starting with this keyword define a variable to include at top level used for this template. Do not use dash for variable name as nunjunks doesn’t support them. The variables variable-source and variable-destination are reserved.

variableFile-

A column starting with this keyword define a variable file to include at top level used for this template.

Tip

Good variable name : * variable-myIp * variable-deviceMac

Error

Invalid variable by using invalid variable for nunjucks :

  • variable-my-ip

  • variable-device-mac

Error

Invalid variable because using reserved name :

  • variable-source

  • variable-destination

Variable types

Variable type

Support

Description

Number

Supported feature

Floating numbers must use a “.” and not a “,” - numbers padded with “0” (e.g 002) need to be processed through Nunjucks to keep their padding

Boolean

Supported feature

Use true or false

Text

Supported feature

Object

Not supported feature

There is multiples solutions to include JSON object with variableFiles for example