2025-02-03 20:20:15 +01:00
The families
=============
2023-12-17 20:25:53 +01:00
Synopsis
---------
2025-02-03 20:20:15 +01:00
.. glossary ::
family
2026-03-19 16:57:13 +01:00
subfamily
2026-05-31 21:22:53 +02:00
A family (or a subfamily) is simply a collection of variables that refer to
2025-02-03 20:20:15 +01:00
the same business model category. It's just a variables container.
Think of it as a container as well as a namespace.
2023-12-17 20:25:53 +01:00
.. attention :: A family without a subfamily or subvariable will be automatically deleted.
2026-05-31 21:22:53 +02:00
Naming
---------
2025-02-03 20:20:15 +01:00
It is with its name that we will be able to interact with the family.
2023-12-17 20:25:53 +01:00
2025-02-03 20:20:15 +01:00
.. seealso ::
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
Have a look at the :ref: `family naming convention <namingconvention>`
2023-12-17 20:25:53 +01:00
2024-07-01 14:06:59 +02:00
Shorthand declaration
----------------------------
2026-05-31 21:22:53 +02:00
Shorthand declaration is a way to declare a family in a single line.
To create a family, just add a key with it's name and variables as values.
Here is a simple example:
.. code-block :: yaml
2024-07-01 14:06:59 +02:00
2026-05-31 21:22:53 +02:00
%YAML 1.2
---
version: 1.1
my_family:
variable:
...
2024-07-01 14:06:59 +02:00
By default, the description of the variable is the family name.
2026-05-31 21:22:53 +02:00
It's a best practice to description a family. Just add comment in same line of name, this comment is use as description.
2024-07-01 14:06:59 +02:00
.. code-block :: yaml
2026-05-31 21:22:53 +02:00
%YAML 1.2
2024-07-01 14:06:59 +02:00
---
2026-05-31 21:22:53 +02:00
version: 1.1
2024-07-01 14:06:59 +02:00
my_family: # This is a great family
2026-05-31 21:22:53 +02:00
2024-07-01 14:06:59 +02:00
variable:
2026-05-31 21:22:53 +02:00
...
But in shorthand notation, you can only define family name and description.
.. attention :: Any other parameters will be considered as a variable. Do not use shorthand in this case.
2024-07-01 14:06:59 +02:00
2023-12-17 20:25:53 +01:00
Parameters
---------------
2024-03-28 09:43:33 +01:00
.. list-table ::
2023-12-17 20:25:53 +01:00
:widths: 15 45
:header-rows: 1
* - Parameter
- Comments
2024-03-28 09:43:33 +01:00
2023-12-17 20:25:53 +01:00
* - description, _description
`string`
- Description of the family.
2024-03-28 09:43:33 +01:00
2023-12-17 20:25:53 +01:00
User information to understand the usefulness of the family.
* - help, _help
`string`
- Additional help associated with the family.
2026-05-31 21:22:53 +02:00
.. seealso :: tutorial with a real world sample :ref: `help parameter <tutorial/examples>` (the tutorial focuses on variable, but the principle is the same for a family)
2023-12-17 20:25:53 +01:00
* - mode, _mode
`string`
- Family mode.
The default mode of a family is the smallest mode of the parent families, child variables, or child families that are contained in that family.
2024-03-28 09:43:33 +01:00
2023-12-17 20:25:53 +01:00
This mode also allows you to define the default mode for variables or families included in this family.
2024-03-28 09:43:33 +01:00
2026-05-31 21:22:53 +02:00
.. seealso :: tutorial with a real world sample :ref: `mode parameter <tutorial/mode>` (the tutorial focuses on variable, but the principle is the same for a family)
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
* - type, _type
2023-12-17 20:25:53 +01:00
`string`
2026-05-31 21:22:53 +02:00
- possible values:
- `family` (**default value** )
- `dynamic`
- `leadership`
* - hidden, _hidden
`boolean` or `calculation`
2023-12-17 20:25:53 +01:00
- Invisible family.
2024-03-28 09:43:33 +01:00
2023-12-17 20:25:53 +01:00
Allows you to hide a family as well as the variables or families included in this family.
This means that the family will no longer be visible in `read-write` mode, but only for calculations or in `read-only` mode.
2026-05-31 21:22:53 +02:00
The default value is `false` .
.. seealso :: tutorial with a real world sample :ref: `hidden parameter <tutorial/properties>`
2023-12-17 20:25:53 +01:00
* - disabled, _disabled
2026-05-31 21:22:53 +02:00
`boolean` or `calculation`
2023-12-17 20:25:53 +01:00
- Disabled family.
2024-03-28 09:43:33 +01:00
2023-12-17 20:25:53 +01:00
Allows you to deactivate a family as well as the variables or families included in this family.
2024-03-28 09:43:33 +01:00
2023-12-17 20:25:53 +01:00
This means that the family will no longer be visible to the user but also to a :term: `calculation` .
2026-05-31 21:22:53 +02:00
The default value is `false` .
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. seealso :: tutorial with a real world sample :ref: `disabled parameter <tutorial/properties>`
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
* - dynamic, _dynamic
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
`calculation` or a list of `calculation` or `string`
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
- Dynamic identifiers.
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. important :: this parameter is only available for dynamically built family
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. note ::
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
If a subfamily or a subvariable already has the name of a parameter it is possible to use the "_<parameter>" name.
You can have a look at the tutorial with a real world sample :ref: `of parameter with "_" <tutorial/underscore_parameter>` .
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
A family
---------
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
Here is a simple example:
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. code-block :: yaml
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
%YAML 1.2
---
version: 1.1
my_family:
description: This is a great family
help: This family is great because we have great variables inside
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
variable:
...
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. seealso ::
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
You can have a look at the tutorial with a real world sample:
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
- :ref: `family <tutorial/family>`
- :ref: `help parameter <tutorial/examples>` (the tutorial focuses on variable, but the principle is the same for a family)
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
A dynamically built family
-----------------------------
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
To create a family dynamically, you must create a fictitious family linked to a list of uniq identifiers.
This list could be hard coded or resulting from a calculation
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
In this case if the result of calculation were to evolve, new dynamic families will appear or disappear.
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
The name of this family is particular. You have to add `{{ identifier }}` string inside. It will be replace by each identifiers.
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
Here is an simple example:
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. code-block :: yaml
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
%YAML 1.2
---
version: 1.1
my_{{ identifier }}_family:
description: 'A family for {{ identifier }}'
dynamic:
- one thing
- another
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
variable:
description: 'A variable for {{ identifier }}'
...
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
This will dynamically create two families:
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
- "my_one_thing_family"
- "my_another_family"
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. seealso ::
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
You can have a look at the tutorial with a real world sample :ref: `dynamically built family <tutorial/dynfam>`
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
Similar object sequence
-------------------------
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
A family with `type` set to `leadership` is a sequence of similar object.
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
Let's start the explanation with a concrete example:
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. code-block :: yaml
2024-03-28 09:43:33 +01:00
2026-05-31 21:22:53 +02:00
%YAML 1.2
---
version: 1.1
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
accounts:
description: All accounts
type: leadership
2024-03-28 09:43:33 +01:00
2026-05-31 21:22:53 +02:00
login:
description: Account login
type: unix_user
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
secret:
description: Account secret
type: secret
...
2024-03-28 09:43:33 +01:00
2026-05-31 21:22:53 +02:00
What is expected, it's something like:
2024-03-28 09:43:33 +01:00
2026-05-31 21:22:53 +02:00
.. code-block :: yaml
2024-03-28 09:43:33 +01:00
2026-05-31 21:22:53 +02:00
---
accounts:
- login: foo
secret: 0hM%G0dW4a7ASecr3t
- login: bar
secret: NotGoodSecret
2024-03-28 09:43:33 +01:00
2026-05-31 21:22:53 +02:00
It's what we call a sequence of similar object.
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. attention :: A sequence cannot contain other families.
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. seealso ::
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
You can have a look at the tutorial with a real world sample :ref: `similar object sequence <tutorial/sequence>`
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
A custom type family
----------------------
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
In short, a custom type is nothing more than a kind of a template for a family.
Define a custom type family is much like defining families.
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
This custom type family can be used as many times as desired and customized as you wish.
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
.. seealso ::
2023-12-17 20:25:53 +01:00
2026-05-31 21:22:53 +02:00
You can have a look at the tutorial with a real world sample :ref: `family custom type <tutorial/family>`