feat(map): update to v4 “map.jinja”

The `map.jinja` now exports a single variable called `mapdata`.

We extract the `openssh`, `sshd_config` and `ssh_config` from it to
minimize the changes to `.sls` files.
This commit is contained in:
Daniel Dehennin
2020-07-31 10:54:40 +02:00
parent a8cd7370df
commit df477b25c2
25 changed files with 388 additions and 119 deletions
+3 -10
View File
@@ -3,18 +3,11 @@
---
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import openssh with context %}
{%- from tplroot ~ "/map.jinja" import ssh_config with context %}
{%- from tplroot ~ "/map.jinja" import sshd_config with context %}
{%- from tplroot ~ "/map.jinja" import mapdata with context %}
{%- set output_file = '/tmp/salt_mapdata_dump.yaml' %}
{%- set map = {
'openssh': openssh,
'ssh_config': ssh_config,
'sshd_config': sshd_config,
} %}
{%- do salt['log.debug']( map | yaml(False) ) %}
{%- do salt['log.debug']( mapdata | yaml(False) ) %}
{{ tplroot }}-mapdata-dump:
file.managed:
@@ -22,4 +15,4 @@
- source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja
- template: jinja
- context:
map: {{ map | yaml }}
map: {{ mapdata | yaml }}