kayobe/ansible/roles/ssh-known-host/tasks/main.yml
2017-02-14 15:14:29 +00:00

18 lines
423 B
YAML

---
- name: Scan for SSH keys
local_action:
module: command ssh-keyscan {{ item }}
with_items:
- "{{ ansible_host|default(inventory_hostname) }}"
register: keyscan_result
changed_when: False
- name: Ensure SSH keys are in known hosts
local_action:
module: known_hosts
host: "{{ item[0].item }}"
key: "{{ item[1] }}"
with_subelements:
- "{{ keyscan_result.results }}"
- stdout_lines