Skip to content

Commit d06277b

Browse files
committed
map.jinja: use grains.filter_by instead of defaults.merge
because defaults.merge does not work with salt-ssh. saltstack/salt#51605 Added osfingermap.yaml.
1 parent a143add commit d06277b

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

Diff for: template/map.jinja

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
# vim: ft=jinja
33

44
{## Start imports as ##}
5-
{% import_yaml 'template/defaults.yaml' as defaults %}
5+
{% import_yaml 'template/defaults.yaml' as default_settings %}
66
{% import_yaml 'template/osfamilymap.yaml' as osfamilymap %}
77
{% import_yaml 'template/osmap.yaml' as osmap %}
8+
{% import_yaml 'template/osfingermap.yaml' as osfingermap %}
89

9-
{## Merge the osfamilymap ##}
10-
{% set osfamily = salt['grains.filter_by'](osfamilymap, grain='os_family') or {} %}
11-
{% do salt['defaults.merge'](defaults['template'], osfamily) %}
12-
13-
{## Merge the osmap ##}
14-
{% set os = salt['grains.filter_by'](osmap, grain='os') or {} %}
15-
{% do salt['defaults.merge'](defaults['template'], os) %}
16-
17-
{## Merge the lookup ##}
18-
{% set lookup = salt['pillar.get']('template:lookup', default={}) %}
19-
{% do salt['defaults.merge'](defaults['template'], lookup) %}
10+
{% set defaults = salt['grains.filter_by'](default_settings,
11+
default='template',
12+
merge=salt['grains.filter_by'](osfamilymap, grain='os_family',
13+
merge=salt['grains.filter_by'](osmap, grain='os',
14+
merge=salt['grains.filter_by'](osfingermap, grain='osfinger',
15+
merge=salt['pillar.get']('template:lookup', default={})
16+
)
17+
)
18+
)
19+
) %}
2020

2121
{## Merge the template pillar ##}
22-
{% set template = salt['pillar.get']('template', default=defaults['template'], merge=True) %}
22+
{% set template = salt['pillar.get']('template', default=defaults, merge=True) %}

Diff for: template/osfingermap.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
#
4+
# Setup variables using grains['osfinger'] based logic.
5+
# You just need to add the key:values for an `osfinger` that differ
6+
# from `defaults.yaml` + `os_family.yaml` + `osmap.yaml`.
7+
# Only add an `osfinger` which is/will be supported by the formula
8+
# (empty `osfinger`s do not need to be listed, just added here as an example).
9+
---
10+
CentOS-6:
11+
pkg: template-centos-6
12+
config: /etc/template.d/custom-centos-6.conf
13+
CentOS-7: {}

0 commit comments

Comments
 (0)