Skip to content
Snippets Groups Projects
Commit 11b88293 authored by Lars Beckers's avatar Lars Beckers
Browse files

hostkey-provider: implement fallback if fqdn fact is not available

parent 77f52c9d
No related branches found
No related tags found
No related merge requests found
......@@ -5,10 +5,11 @@
{{ v['ansible_host'] }},{{ v['ansible_all_ipv4_addresses']|join(',') }},{{ v['ansible_all_ipv6_addresses']|join(',') }} ssh-rsa {{ v['ansible_ssh_host_key_rsa_public'] }}
{%- else -%}
#}
{%- if 'ansible_local' in hostvars[hostkeys_collector] and 'hostkeys_' ~ v['ansible_fqdn'] in hostvars[hostkeys_collector]['ansible_local'] %}
{%- set c = hostvars[hostkeys_collector]['ansible_local']['hostkeys_'~ v['ansible_fqdn']]['collected'] -%}
{{ v['ansible_fqdn'] }},{{ c['ipv4'] }},{{ c['ipv6'] }} ssh-ed25519 {{ c['ed25519'] }}
{{ v['ansible_fqdn'] }},{{ c['ipv4'] }},{{ c['ipv6'] }} ssh-rsa {{ c['rsa'] }}
{%- set fqdn = v['ansible_fqdn'] if 'ansible_fqdn' in v else v['ansible_host'] -%}
{%- if 'ansible_local' in hostvars[hostkeys_collector] and 'hostkeys_' ~ fqdn in hostvars[hostkeys_collector]['ansible_local'] %}
{%- set c = hostvars[hostkeys_collector]['ansible_local']['hostkeys_'~ fqdn]['collected'] -%}
{{ fqdn }},{{ c['ipv4'] }},{{ c['ipv6'] }} ssh-ed25519 {{ c['ed25519'] }}
{{ fqdn }},{{ c['ipv4'] }},{{ c['ipv6'] }} ssh-rsa {{ c['rsa'] }}
{% endif -%}
{#
{%- endif -%}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment