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 |
|
An |
The source of the template |
1 |
|
An |
The destination on witch the source will by “copy/pasted” |
2 |
|
An path relative to the git |
The rule to apply Evaluation rules |
3+ |
|
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 |
---|---|
|
A column starting with this keyword define a variable to include at top level used for this template. Do not use |
|
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 |
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 |
Use |
|
Text |
||
Object |
There is multiples solutions to include JSON object with variableFiles for example |