openssh-formula/openssh/known_hosts.sls
Daniel Dehennin 7a1f6199d0 fix(jinja): encode context as json
Or with python2 the template are generated with `u'<string>'`.
2020-07-20 16:28:22 +02:00

24 lines
733 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", {}) | json }}
- user: root
- group: {{ openssh.ssh_config_group }}
- mode: 644
- require:
- pkg: ensure dig is available