Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


ssh_known_hosts (35) Versions 0.7.2

Dyanmically generates /etc/ssh/ssh_known_hosts based on search indexes

cookbook 'ssh_known_hosts', '= 0.7.2'
cookbook 'ssh_known_hosts', '= 0.7.2', :supermarket
knife supermarket install ssh_known_hosts
knife supermarket download ssh_known_hosts
Quality -%

Chef SSH Known Hosts Cookbook

The Chef ssh_known_hosts cookbook exposes an LWRP and default recipe for adding hosts and keys to the /etc/ssh_known_hosts file.

  • The default recipe builds /etc/ssh/known_hosts based on search indexes and ohai data.
  • The LWRP provides a way to add custom entries in your own recipes.

You can also optionally put other host keys in a data bag called "ssh_known_hosts". See below for details.


  • An operating system that supports /etc/ssh/ssh_known_hosts
  • (Chef Search is required for the default recipe, but not the LWRP)



Use the LWRP ssh_known_hosts_entry to append an entry for the specified host in /etc/ssh/ssh_known_hosts. For example:

ssh_known_hosts_entry ''

This will append an entry in /etc/ssh/ssh_known_hosts like this:

# SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze1+github8 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==

You can optionally specify your own key, if you don't want to use ssh-keyscan:

ssh_known_hosts_entry '' do
  key ' ssh-rsa ...'
LWRP Attributes

<table> <thead> <tr> <th>Attribute</th> <th>Description</th> <th>Example</th> <th>Default</th> </tr> </thead>

<tbody> <tr> <td>host</td> <td>the host to add</td> <td><tt></tt></td> <td></td> </tr> <tr> <td>key</td> <td>(optional) provide your own key</td> <td><tt>ssh-rsa ...</tt></td> <td><tt>ssh-keyscan -H #{host}</tt></td> </tr> </tbody> </table>

Default Recipe

Searches the Chef Server for all hosts that have SSH host keys and generates an /etc/ssh/ssh_known_hosts.

Adding custom host keys

There are two ways to add custom host keys. You can either use the provided LWRP (see above), or by creating a data bag called "ssh_known_hosts" and adding an item for each host:

  "id": "github",
  "fqdn": "",
  "rsa": "github-rsa-host-key"

There are additional optional values you may use in the data bag:

<table> <thead> <tr> <th>Attribute</th> <th>Description</th> <th>Example</th> <th>Default</th> </tr> </thead>

<tbody> <tr> <td>id</td> <td>a unique id for this data bag entry</td> <td><tt>github</tt></td> <td></td> </tr> <tr> <td>fqdn</td> <td>the fqdn of the host</td> <td><tt></tt></td> <td></td> </tr> <tr> <td>rsa</td> <td>the rsa key for this server</td> <td><tt>ssh-rsa AAAAB3...</tt></td> <td></td> </tr> <tr> <td>ipaddress</td> <td>the ipaddress of the node (if fqdn is missing)</td> <td><tt></tt></td> <td></td> </tr> <tr> <td>hostname</td> <td>local hostname of the server (if not a fqdn)</td> <td><tt>myserver.local</tt></td> <td></td> </tr> <tr> <td>dsa</td> <td>the dsa key for this server</td> <td><tt>ssh-dsa ABAAC3...</tt></td> <td></td> </tr> </tbody> </table>

License and Authors

Copyright:: 2011-2013, Opscode, Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

builder Applicable Versions
config-driven-helper Applicable Versions
deploy-user Applicable Versions
eucalyptus Applicable Versions
git_user Applicable Versions
github_connector Applicable Versions
github_users Applicable Versions
gitolite-server Applicable Versions
hadoop_for_hbase Applicable Versions
jenkins_drupal Applicable Versions
nodestack Applicable Versions
prun-cfg Applicable Versions
rdiff-backup Applicable Versions
resin Applicable Versions
stack-base Applicable Versions

No quality metric results found