Skip to content

Instantly share code, notes, and snippets.

@thoralfliersch
Last active January 26, 2017 16:51
Show Gist options
  • Save thoralfliersch/92083c0847daf382ae783c8db716bb6e to your computer and use it in GitHub Desktop.
Save thoralfliersch/92083c0847daf382ae783c8db716bb6e to your computer and use it in GitHub Desktop.
- name: ensure example.com is a known host
lineinfile:
dest: "{{ item }}"
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -H -t rsa example.com') }}"
with_items:
- /etc/ssh/ssh_known_hosts
- /root/.ssh/known_hosts
- /home/deploy/.ssh/known_hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment