From d69556d5ae79a907d79351d4b9775e0ce2970b39 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Mon, 11 Jan 2021 17:47:11 +0100 Subject: [PATCH] feat(matchers): add delimiter option for source definitions --- docs/map.jinja.rst | 47 ++++++++++++++++++++++++++++++++++++++- openssh/libmatchers.jinja | 32 ++++++++++++++++++-------- openssh/map.jinja | 1 + 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/docs/map.jinja.rst b/docs/map.jinja.rst index dab217b..7c34b10 100644 --- a/docs/map.jinja.rst +++ b/docs/map.jinja.rst @@ -197,6 +197,47 @@ For the clients: Since we used ``Y:C@roles``, ``map.jinja`` will do a ``salt['config.get']('roles')`` to retrieve the roles so you could use any other method to bind roles to minions (`pillars`_ or `SDB`_) but `grains`_ seems to be the prefered method. +Note for Microsoft Windows systems +`````````````````````````````````` + +If you have a minion running under windows, you can't use colon ``:`` as a delimiter for grain path query (see `bug 58726`_) in which case you should use an alternate delimiter: + +Modify ``/srv/salt/parameters/map_jinja.yaml`` to change the query for ``dns:domain`` to define the `alternate delimiter`_: + +.. code-block:: yaml + + --- + values: + sources: + # default values + - "Y:G@osarch" + - "Y:G@os_family" + - "Y:G@os" + - "Y:G@osfinger" + - "C@{{ tplroot ~ ':lookup' }}" + - "C@{{ tplroot }}" + + # Roles activate/deactivate things + # then thing are configured depending on environment + # So roles comes before `dns:domain`, `domain` and `id` + - "Y:C@roles" + + # DNS domain configured (DHCP or resolv.conf) + - "Y:G:!@dns!domain" + + # Based on minion ID + - "Y:G@domain" + + # default values + - "Y:G@id" + ... + +And then, rename the directory: + +.. code-block:: console + + mv /srv/salt/TEMPLATE/parameters/dns:domain/ '/srv/salt/TEMPLATE/parameters/dns!domain/' + Format of configuration YAML files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -246,7 +287,7 @@ The ``map.jinja`` file uses several sources where to lookup parameter values. Th 1. a global ``salt://parameters/map_jinja.yaml`` 2. a per formula ``salt://{{ tplroot }}/parameters/map_jinja.yaml``, it overrides the global configuration -Each source definition has the form ``: