Move ssh_known_hosts generation to own role

This commit is contained in:
Timo Makinen 2021-09-19 16:29:32 +00:00
parent b406b64782
commit ffbe68294b
4 changed files with 11 additions and 8 deletions

View file

@ -0,0 +1,8 @@
---
- name: create ssh known_hosts
template:
dest: /etc/ssh/ssh_known_hosts
src: ssh_known_hosts.j2
mode: 0644
owner: root
group: "{{ ansible_wheel }}"

View file

@ -0,0 +1,5 @@
{% for host, vars in hostvars|dictsort %}
{% if vars["ansible_ssh_host_key_ed25519_public"] is defined %}
{{ host }} ssh-ed25519 {{ vars["ansible_ssh_host_key_ed25519_public"] }}
{% endif %}
{% endfor %}