@@ -1,8 +1,10 @@ | |||||
ssh_host_key_state: configured | |||||
ssh_host: "{{ ansible_host | default(inventory_hostname) }}" | |||||
ssh_host_key_types: | ssh_host_key_types: | ||||
- ed25519 | - ed25519 | ||||
- ecdsa | - ecdsa | ||||
- rsa | - rsa | ||||
ssh_host_key_state: configured | |||||
ssh_scan_host: "{% if ssh_ip is defined %}{{ ssh_ip }}{% else %}{{inventory_hostname}}{% endif %}" | |||||
ssh_update_local_known_hosts_file: true | ssh_update_local_known_hosts_file: true |
@@ -5,6 +5,6 @@ | |||||
args: | args: | ||||
path: "{{ lookup('env','HOME') }}/.ssh/known_hosts" | path: "{{ lookup('env','HOME') }}/.ssh/known_hosts" | ||||
name: "{{ inventory_hostname }}" | name: "{{ inventory_hostname }}" | ||||
key: "{{ lookup('template','ssh_host_key.j2') }}" | |||||
key: "{{ inventory_hostname }},{{ ssh_host }} ssh-ed25519 {{ ssh_host_key_ed25519_public }}" | |||||
when: ssh_host_key_ed25519_public is defined | when: ssh_host_key_ed25519_public is defined | ||||
throttle: 1 | throttle: 1 |
@@ -1,7 +1,7 @@ | |||||
--- | --- | ||||
- name: scan ssh host | - name: scan ssh host | ||||
local_action: command ssh-keyscan -t ed25519 {{ssh_scan_host}} | |||||
local_action: command ssh-keyscan -t ed25519 {{ssh_host}} | |||||
register: _ssh_keyscan_result | register: _ssh_keyscan_result | ||||
changed_when: false | changed_when: false | ||||
@@ -1,5 +0,0 @@ | |||||
{% if ssh_ip is defined %} | |||||
{{ inventory_hostname }},{{ ssh_ip }} ssh-ed25519 {{ ssh_host_key_ed25519_public }} | |||||
{% else %} | |||||
{{ inventory_hostname }},{{ ansible_host }} ssh-ed25519 {{ ssh_host_key_ed25519_public }} | |||||
{% endif %} |