Skip to content

Instantly share code, notes, and snippets.

@andymotta
Created July 31, 2018 00:12
Show Gist options
  • Save andymotta/9d79dba16aa7c22fb27c3df977cd5895 to your computer and use it in GitHub Desktop.
Save andymotta/9d79dba16aa7c22fb27c3df977cd5895 to your computer and use it in GitHub Desktop.
Scan host for public keys then add keys to knows_hosts (ssh)
# path default of known_hosts module is home of the user running the playbook, i.e. $HOME/.ssh/known_hosts
- name: find public key for stash
command: ssh-keyscan "{{ domain }}"
register: pub_key
- name: add public key for stash to known_hosts
known_hosts:
name: "{{ domain }}"
key: "{{ pub_key.stdout }}"
state: "present"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment