Created
July 11, 2013 15:09
-
-
Save jhedden/5976292 to your computer and use it in GitHub Desktop.
Ansible ssh_known_hosts template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for host in groups['all'] %} | |
{% set hostnames_ips = hostvars[host]['ansible_fqdn'] + ',' + hostvars[host]['ansible_hostname'] + ',' + hostvars[host]['ansible_all_ipv4_addresses']|join(',') %} | |
{% if hostvars[host]['ansible_ssh_host_key_rsa_public'] %} | |
{{ hostnames_ips }} ssh-rsa {{ hostvars[host]['ansible_ssh_host_key_rsa_public'] }} | |
{% endif %} | |
{% if hostvars[host]['ansible_ssh_host_key_dsa_public'] %} | |
{{ hostname_ips }} ssh-dsa {{ hostvars[host]['ansible_ssh_host_key_dsa_public'] }} | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment