Browse Source

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

tags/v0.41.0
Alexander Weidinger 5 years ago
parent
commit
29b89f0fb9
2 changed files with 37 additions and 39 deletions
  1. +28
    -27
      openssh/defaults.yaml
  2. +9
    -12
      openssh/map.jinja

+ 28
- 27
openssh/defaults.yaml View File

@@ -1,28 +1,29 @@
openssh:
sshd_enable: True
sshd_binary: /usr/sbin/sshd
sshd_config: /etc/ssh/sshd_config
sshd_config_src: salt://openssh/files/sshd_config
sshd_config_user: root
sshd_config_group: root
sshd_config_mode: '644'
sshd_config_backup: True
ssh_config: /etc/ssh/ssh_config
ssh_config_src: salt://openssh/files/ssh_config
ssh_config_user: root
ssh_config_group: root
ssh_config_mode: '644'
ssh_config_backup: True
banner: /etc/ssh/banner
banner_src: salt://openssh/files/banner
ssh_known_hosts: /etc/ssh/ssh_known_hosts
dig_pkg: dnsutils
ssh_moduli: /etc/ssh/moduli
root_group: root
# Prevent merge of array; always override values
host_key_algos: ecdsa,ed25519,rsa
# To manage/remove DSA:
#host_key_algos: dsa,ecdsa,ed25519,rsa
default:
openssh:
sshd_enable: True
sshd_binary: /usr/sbin/sshd
sshd_config: /etc/ssh/sshd_config
sshd_config_src: salt://openssh/files/sshd_config
sshd_config_user: root
sshd_config_group: root
sshd_config_mode: '644'
sshd_config_backup: True
ssh_config: /etc/ssh/ssh_config
ssh_config_src: salt://openssh/files/ssh_config
ssh_config_user: root
ssh_config_group: root
ssh_config_mode: '644'
ssh_config_backup: True
banner: /etc/ssh/banner
banner_src: salt://openssh/files/banner
ssh_known_hosts: /etc/ssh/ssh_known_hosts
dig_pkg: dnsutils
ssh_moduli: /etc/ssh/moduli
root_group: root
# Prevent merge of array; always override values
host_key_algos: ecdsa,ed25519,rsa
# To manage/remove DSA:
#host_key_algos: dsa,ecdsa,ed25519,rsa

sshd_config: {}
ssh_config: {}
sshd_config: {}
ssh_config: {}

+ 9
- 12
openssh/map.jinja 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) %}

Loading…
Cancel
Save