Browse Source

ssh scan host configurable

master
parent
commit
d8786e705f
2 changed files with 6 additions and 1 deletions
  1. +1
    -0
      defaults/main.yml
  2. +5
    -1
      tasks/scan.yml

+ 1
- 0
defaults/main.yml View File

@@ -4,3 +4,4 @@ ssh_host_key_types:
- rsa - rsa
ssh_ip: "{{ansible_host}}" ssh_ip: "{{ansible_host}}"
ssh_host_key_state: configured ssh_host_key_state: configured
ssh_scan_host: "{{inventory_hostname}}"

+ 5
- 1
tasks/scan.yml View File

@@ -1,10 +1,14 @@
--- ---


- name: scan ssh host - 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 register: _ssh_keyscan_result
changed_when: false changed_when: false


#- name: _ssh_keyscan_result
# debug:
# msg: "{{ _ssh_keyscan_result }}"

- name: set ssh_host_key_ed25519_public - name: set ssh_host_key_ed25519_public
set_fact: set_fact:
ssh_host_key_ed25519_public: "{{ _ssh_keyscan_result.stdout.split()[2] }}" ssh_host_key_ed25519_public: "{{ _ssh_keyscan_result.stdout.split()[2] }}"


Loading…
Cancel
Save