Skip to content

Instantly share code, notes, and snippets.

@natemccurdy
Created November 18, 2015 01:50
Show Gist options
  • Save natemccurdy/683c9b8b99ab3290a614 to your computer and use it in GitHub Desktop.
Save natemccurdy/683c9b8b99ab3290a614 to your computer and use it in GitHub Desktop.
Automagically create known_hosts entries with Puppet
# This example shows how to automatically populate the SSH known_hosts file
# on a node so that SSH'ing to the node won't ask you to verify it's fingerprint.
# This requires a version of Facter that uses structure facts.
# Node 'foo' exports its public HOST KEY.
node 'foo' {
@@sshkey { $::clientcert:
ensure => present,
host_aliases => [$::ipaddress],
key => $::ssh['rsa']['key'],
type => 'rsa',
tag => 'foobar',
}
}
# Node 'bar' collects all exported HOST KEYS.
node 'bar' {
Sshkey <<| tag == 'foobar' |>>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment