Skip to content

Instantly share code, notes, and snippets.

@mrlesmithjr
Last active January 26, 2017 03:15
Show Gist options
  • Save mrlesmithjr/71f0669dfb970b4904a7cbe8b8e46863 to your computer and use it in GitHub Desktop.
Save mrlesmithjr/71f0669dfb970b4904a7cbe8b8e46863 to your computer and use it in GitHub Desktop.
---
- hosts: all
become: true
tasks:
- name: scan and register
command: "ssh-keyscan {{ item }}"
register: "host_keys"
changed_when: false
with_items: '{{ groups.all }}'
delegate_to: localhost
become: false
- name: write keys
template:
src: "ssh-hosts.j2"
dest: "/etc/ssh/ssh_known_hosts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment