fix(jinja): encode context as json

Or with python2 the template are generated with `u'<string>'`.
This commit is contained in:
Daniel Dehennin 2020-07-20 16:28:22 +02:00
parent 7752132275
commit 7a1f6199d0
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ sshd_config:
) }} ) }}
- template: jinja - template: jinja
- context: - context:
sshd_config: {{ sshd_config }} sshd_config: {{ sshd_config | json }}
- user: {{ openssh.sshd_config_user }} - user: {{ openssh.sshd_config_user }}
- group: {{ openssh.sshd_config_group }} - group: {{ openssh.sshd_config_group }}
- mode: {{ openssh.sshd_config_mode }} - mode: {{ openssh.sshd_config_mode }}
@ -40,7 +40,7 @@ ssh_config:
) }} ) }}
- template: jinja - template: jinja
- context: - context:
ssh_config: {{ ssh_config }} ssh_config: {{ ssh_config | json }}
- user: {{ openssh.ssh_config_user }} - user: {{ openssh.ssh_config_user }}
- group: {{ openssh.ssh_config_group }} - group: {{ openssh.ssh_config_group }}
- mode: {{ openssh.ssh_config_mode }} - mode: {{ openssh.ssh_config_mode }}

View File

@ -15,7 +15,7 @@ manage ssh_known_hosts file:
) }} ) }}
- template: jinja - template: jinja
- context: - context:
known_hosts: {{ openssh | traverse("known_hosts", {}) }} known_hosts: {{ openssh | traverse("known_hosts", {}) | json }}
- user: root - user: root
- group: {{ openssh.ssh_config_group }} - group: {{ openssh.ssh_config_group }}
- mode: 644 - mode: 644