cb6e48feaa
We pass the pillars via the template engine context, this avoid the need to load `map.jinja` from the templates themselves and recude the number of `pillar.get` calls. * openssh/config.sls (sshd_config): pass `sshd_config` in the context. (ssh_config): pass `ssh_config` in the context. * openssh/files/default/ssh_config: remove `map.jinja` import since it's now in the context. * openssh/files/default/sshd_config: ditoo. * openssh/known_hosts.sls: pass `known_hosts` in the context. * openssh/files/default/ssh_known_hosts: use `known_hosts` from the context instead of calling `pillar.get` several times. BREAKING CHANGE: Minimum Salt version support is now `2019.2` in line with official upstream support; also use of the `traverse` Jinja filter.
24 lines
726 B
Plaintext
24 lines
726 B
Plaintext
{%- set tplroot = tpldir.split('/')[0] %}
|
|
{%- from tplroot ~ "/map.jinja" import openssh with context %}
|
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch %}
|
|
|
|
ensure dig is available:
|
|
pkg.installed:
|
|
- name: {{ openssh.dig_pkg }}
|
|
- unless: which dig
|
|
|
|
manage ssh_known_hosts file:
|
|
file.managed:
|
|
- name: {{ openssh.ssh_known_hosts }}
|
|
- source: {{ files_switch( [openssh.ssh_known_hosts_src],
|
|
'manage ssh_known_hosts file'
|
|
) }}
|
|
- template: jinja
|
|
- context:
|
|
known_hosts: {{ openssh | traverse("known_hosts", {}) }}
|
|
- user: root
|
|
- group: {{ openssh.ssh_config_group }}
|
|
- mode: 644
|
|
- require:
|
|
- pkg: ensure dig is available
|