document puppet subgroup

This commit is contained in:
2024-06-21 15:52:37 +02:00
parent 00717b21e3
commit 0d9d3c529e
3 changed files with 45 additions and 29 deletions
+33 -24
View File
@@ -4,25 +4,36 @@ Hiera
Look `here <https://docs.puppet.com/hiera/3.1/>`_ for a general Hiera
introduction.
The current hierarchy has four levels (first will be considered first
The current hierarchy has seven levels (first will be considered first
during value lookup):
- nodes (FQDN)
- subgroup (optional, ``puppet_subgroup`` attribute in sysdb)
- group (``puppet_group`` attribute in sysdb)
- sysdb environments
- Puppet server specific
- global
- common
and values can be stored as classical YAML values or with `encrypted yaml
The first four layers can be edited by the admin in the respective hiera git repository.
The common layer (default values) and the server specific layer (differences between test and prod) are part of the Puppet code repository.
Finally the global layer contains a few configurations which are managed by the Core Linux Group outside of the normal Puppet release process, eg. for license management.
The values can be stored as classical YAML values or with `encrypted yaml
<https://github.com/TomPoulton/hiera-eyaml>`_ for secrets.
The filesystem structure is as follows:
1. ``%{::sysdb_env}/%{::group}/%{::fqdn}``
2. ``%{::sysdb_env}/%{::group}``
3. ``%{::sysdb_env}/%{::sysdb_env}``
4. ``%{::environment}/data/common``
1. ``%{::sysdb_env}/%{::group}/%{::fqdn}.yaml`` or ``%{::sysdb_env}/%{::group}/%{::subgroup}/%{::fqdn}.yaml``
2. ``%{::sysdb_env}/%{::group}/%{::subgroup}.yaml``
3. ``%{::sysdb_env}/%{::group}.yaml``
4. ``%{::sysdb_env}/%{::sysdb_env}.yaml``
5. ``%{::environment}/data/server_%{server_facts.servername}.yaml``
6. ``/srv/puppet/data/global/global.yaml``
7. ``%{::environment}/data/common.yaml``
The ``%{variable}`` notation is hiera specific and each path represents a ``.yaml``
file.
Depending if a subgroup is defined, the node specific YAML is at a different level in the filesysystem hierarchy.
The ``%{variable}`` notation is hiera specific.
Hiera repositories
------------------
@@ -63,36 +74,34 @@ Example
Assuming two sysdb environments ``hpc`` and ``sls``, as well as:
- group ``merlin4`` in ``hpc`` with ``merlinc10`` and ``merlinc11`` in it;
- group ``merlin5`` in ``hpc`` with ``merlin-c001`` and ``merlin-c002`` in it;
- group ``mx`` in ``sls`` with ``mxcn-1`` and ``mxcn-2`` in it;
- group ``merlin4`` in ``hpc`` with ``merlin4l`` and in subgroup ``compute`` ``merlinc10`` and ``merlinc11``
- group ``mx`` in ``sls`` with ``mxcn-1`` and ``mxcn-2``
- host ``xbl-gateway`` in no explicit group (will take the implicit ``default``)
the Hiera structure would look like this::
data/hpc/merlin4/merlinc10.psi.ch.yaml
data/hpc/merlin4/merlinc11.psi.ch.yaml
data/hpc/merlin4/merlin4l.psi.ch.yaml
data/hpc/merlin4/compute/merlinc10.psi.ch.yaml
data/hpc/merlin4/compute/merlinc11.psi.ch.yaml
data/hpc/merlin4.yaml
data/hpc/merlin5/merlin-c001.psi.ch.yaml
data/hpc/merlin5/merlin-c002.psi.ch.yaml
data/hpc/merlin5.yaml
data/hpc.yaml
data/sls/mx/mxcn-1.psi.ch.yaml
data/sls/mx/mxcn-2.psi.ch.yaml
data/sls/mx.yaml
data/sls/default/xbl-gateway.psi.ch.yaml
data/sls.yaml
code/environments/{prod,preprod}/common.yaml
code/{prod,preprod}/server_$SERVERNAME.yaml
data/global/global.yaml
code/{prod,preprod}/common.yaml
While the output of bob would be something like (some unneeded attributes have been removed)::
merlinc10.psi.ch hpc local puppet_group=merlin4
merlinc11.psi.ch hpc local puppet_group=merlin4
merlin-c001.psi.ch hpc local puppet_group=merlin5
merlin-c002.psi.ch hpc local puppet_group=merlin5
mxcn-1.psi.ch sls local puppet_group=mx
mxcn-2.psi.ch sls local puppet_group=mx
xbl-gateway.psi.ch sls local
merlin4l.psi.ch hpc local puppet_group=merlin4
merlinc10.psi.ch hpc local puppet_group=merlin4 puppet_subgroup=compute
merlinc11.psi.ch hpc local puppet_group=merlin4 puppet_subgroup=compute
mxcn-1.psi.ch sls local puppet_group=mx
mxcn-2.psi.ch sls local puppet_group=mx
xbl-gateway.psi.ch sls local
Secret values
-------------