map.jinja: replace defaults.merge with grains.filter_by

This commit is contained in:
Alexander Weidinger 2019-02-12 19:11:46 +01:00
parent 0c6a353969
commit 29b89f0fb9
2 changed files with 37 additions and 39 deletions

View File

@ -1,3 +1,4 @@
default:
openssh:
sshd_enable: True
sshd_binary: /usr/sbin/sshd

View File

@ -2,22 +2,19 @@
# vim: ft=jinja
{## Start imports as ##}
{% import_yaml 'openssh/defaults.yaml' as defaults %}
{% import_yaml 'openssh/defaults.yaml' as default_settings %}
{% import_yaml 'openssh/osfamilymap.yaml' as osfamilymap %}
{% import_yaml 'openssh/osmap.yaml' as osmap %}
{% import_yaml 'openssh/osfingermap.yaml' as osfingermap %}
{## merge the osfamilymap ##}
{% set osfamily = salt['grains.filter_by'](osfamilymap, grain='os_family') or {} %}
{% do salt['defaults.merge'](defaults, osfamily) %}
{## merge the osmap ##}
{% set os = salt['grains.filter_by'](osmap, grain='os') or {} %}
{% do salt['defaults.merge'](defaults, os) %}
{## merge the osfingermap ##}
{% set osfinger = salt['grains.filter_by'](osfingermap, grain='osfinger') or {} %}
{% do salt['defaults.merge'](defaults, osfinger) %}
{% set defaults = salt['grains.filter_by'](default_settings,
default='default',
merge=salt['grains.filter_by'](osfamilymap, grain='os_family',
merge=salt['grains.filter_by'](osmap, grain='os',
merge=salt['grains.filter_by'](osfingermap, grain='osfinger')
)
)
) %}
{## merge the openssh pillar ##}
{% set openssh = salt['pillar.get']('openssh', default=defaults['openssh'], merge=True) %}