diff --git a/defaults/main.yml b/defaults/main.yml index 0e6fcf1..0ae38f6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,3 +4,4 @@ ssh_host_key_types: - rsa ssh_ip: "{{ansible_host}}" ssh_host_key_state: configured +ssh_scan_host: "{{inventory_hostname}}" diff --git a/tasks/scan.yml b/tasks/scan.yml index 8334c2a..0548311 100644 --- a/tasks/scan.yml +++ b/tasks/scan.yml @@ -1,10 +1,14 @@ --- - name: scan ssh host - local_action: command ssh-keyscan -t ed25519 {{ansible_host}} + local_action: command ssh-keyscan -t ed25519 {{ssh_scan_host}} register: _ssh_keyscan_result changed_when: false +#- name: _ssh_keyscan_result +# debug: +# msg: "{{ _ssh_keyscan_result }}" + - name: set ssh_host_key_ed25519_public set_fact: ssh_host_key_ed25519_public: "{{ _ssh_keyscan_result.stdout.split()[2] }}"