Last active
October 25, 2015 17:35
-
-
Save nmarley/2a4325ecd2e21556dc00 to your computer and use it in GitHub Desktop.
Ansible ssh host key scan and set variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
ansible-playbook -e hostname=github.com ssh-host-key-lookup.yml | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
sudo: false | |
vars: | |
node_host_key: "{{ lookup('pipe', 'ssh-keyscan -p 22 ' + hostname) }}" | |
tasks: | |
- debug: | |
msg: "The host key is: {{ node_host_key }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment