Skip to content

Instantly share code, notes, and snippets.

@gbirke
Created March 17, 2016 20:45
Show Gist options
  • Save gbirke/da1eccec6e81a2c9bd55 to your computer and use it in GitHub Desktop.
Save gbirke/da1eccec6e81a2c9bd55 to your computer and use it in GitHub Desktop.
Ansible - Add github.com to list of known hosts
- name: Check if github.com is a known host
command: ssh-keygen -H -F github.com -f {{ known_hosts_file }}
register: github_is_known
ignore_errors: True
- name: Add github to known hosts
shell: ssh-keyscan -H github.com >> {{ known_hosts_file }}
when: github_is_known.stdout == ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment