Permalink
Browse files

Add a README

  • Loading branch information...
markolson committed Jan 2, 2013
1 parent a473a7e commit ad9fe4198dd7e911115edb70bdc7eb7023c8cb40
Showing with 162 additions and 58 deletions.
  1. +1 −8 CHANGELOG.md
  2. +150 −8 README.md
  3. +3 −3 metadata.rb
  4. +2 −2 providers/config.rb
  5. +2 −4 providers/known_hosts.rb
  6. +0 −29 recipes/default.rb
  7. +1 −1 resources/config.rb
  8. +3 −3 resources/known_hosts.rb
View
@@ -1,12 +1,5 @@
# CHANGELOG for ssh
-This file is used to list changes made in each version of ssh.
-
-## 0.1.0:
+## 0.6.0:
* Initial release of ssh
-
-- - -
-Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
-
-The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
View
158 README.md
@@ -1,12 +1,154 @@
-Description
-===========
+# Chef SSH
-Requirements
-============
+## Description
-Attributes
-==========
+Provides 2 LWRPs to manage system-wide and per-user `ssh_config` and `known_host` files.
-Usage
-=====
+## Usage
+When using SSH with Chef deployments, it's crucial to not get any prompts for input. Adding entries to `known_hosts` files and better managing your per-connection configuration can help with this.
+
+## Resources and Providers
+
+### known_hosts
+
+#### Actions
+
+<table>
+ <thead>
+ <tr>
+ <th>Action</th><th>Description</th><th>Default</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>add</td>
+ <td>Adds an entry for the given host to a `known_hosts` file</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>remove</td>
+ <td>Removes entries for a host from a `known_hosts` file</td>
+ <td>&nbsp;</td>
+ </tbody>
+</table>
+
+#### Attributes
+
+<table>
+ <thead>
+ <tr>
+ <th>Attribute</th><th>Description</th><th>Default Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>host</td>
+ <td>
+ <b>Name attribute:</b> the FQDN for a host to add to a `known_hosts` file
+ </td>
+ <td><code>nil</code></td>
+ </tr>
+ <tr>
+ <td>hashed</td>
+ <td>A Boolean indicating if SSH is configured to use a hashed `known_hosts` file.
+ </td>
+ <td><code>true</code></td>
+ </tr>
+ <tr>
+ <td>key</td>
+ <td>A full line to add to the file, instead of performing a lookup for the host.
+ </td>
+ <td><code>nil</code></td>
+ </tr>
+ <tr>
+ <td>user</td>
+ <td>A username to add the `known_hosts` entry for. If unspecified, the known_host will be added system-wide. <b>Note:</b> if specified, the user
+ must already exist.
+ </td>
+ <td><code>nil</code></td>
+ </tr>
+ <tr>
+ <td>path</td>
+ <td>A full path to a known_hosts file. If used with the `user` attribute, this will take precedence over the path to a user's file, but the file will be created (if necessary) as that user.
+ </td>
+ <td><code>nil</code></td>
+ </tr>
+ </tbody>
+</table>
+
+#### Example
+
+ ssh_known_hosts "github.com" do
+ hashed true
+ user 'webapp'
+ end
+
+
+### config
+
+#### Actions
+
+<table>
+ <thead>
+ <tr>
+ <th>Action</th><th>Description</th><th>Default</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>add</td>
+ <td>Adds an entry for the given host to a `ssh_config` file</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>remove</td>
+ <td>Removes entries for a host from a `ssh_config` file</td>
+ <td>&nbsp;</td>
+ </tbody>
+</table>
+
+#### Attributes
+
+<table>
+ <thead>
+ <tr>
+ <th>Attribute</th><th>Description</th><th>Default Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>host</td>
+ <td>
+ <b>Name attribute:</b> the string to match when connecting to a host. This can be an IP, FQDN (github.com), or contain wildcards (*.prod.corp)
+ </td>
+ <td><code>nil</code></td>
+ </tr>
+ <tr>
+ <td>options</td>
+ <td>A hash containing the key-values to write for the host in
+ </td>
+ <td><code>true</code></td>
+ </tr>
+ <tr>
+ <td>user</td>
+ <td>A username to add the `ssh_config` entry for. If unspecified, the known_host will be added system-wide. <b>Note:</b> if specified, the user
+ must already exist.
+ </td>
+ <td><code>nil</code></td>
+ </tr>
+ <tr>
+ <td>path</td>
+ <td>A full path to a known_hosts file. If used with the `user` attribute, this will take precedence over the path to a user's file, but the file will be created (if necessary) as that user.
+ </td>
+ <td><code>nil</code></td>
+ </tr>
+ </tbody>
+</table>
+
+#### Example
+
+ ssh_config "github.com" do
+ options 'User' => 'git', 'IdentityFile' => '/var/apps/github_deploy_key'
+ user 'webapp'
+ end
View
@@ -1,6 +1,6 @@
maintainer "Mark Olson"
maintainer_email "theothermarkolson@gmail.com"
-license "All rights reserved"
-description "Installs/Configures SSH"
+license "Apache 2.0"
+description "LWRPs for managing SSH known_hosts and config files"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "0.1.0"
+version "0.6.0"
View
@@ -1,5 +1,5 @@
include Chef::SSH::PathHelpers
-action :create do
+action :add do
ssh_user = new_resource.user || 'root'
known_hosts_path = default_or_user_path(node['ssh']['config_path'], ssh_user)
@@ -8,7 +8,7 @@
end
-action :destroy do
+action :remove do
ssh_user = new_resource.user || 'root'
known_hosts_path = default_or_user_path(node['ssh']['config_path'], ssh_user)
View
@@ -1,9 +1,7 @@
require 'shellwords'
-
include Chef::SSH::PathHelpers
-
-action :create do
+action :add do
ssh_user = new_resource.user || 'root'
known_hosts_path = default_or_user_path(node['ssh']['known_hosts_path'], ssh_user)
@@ -25,7 +23,7 @@
end
end
-action :delete do
+action :remove do
known_hosts_path = node['ssh']['known_hosts_path']
execute "remove known_host entry for #{new_resource.host}" do
command "ssh-keygen -R #{Shellwords.escape(new_resource.host)}"
View
@@ -1,29 +0,0 @@
-#
-# Cookbook Name:: ssh
-# Recipe:: default
-#
-# Copyright 2013, Mark Olson
-#
-# All rights reserved - Do Not Redistribute
-#
-
-ssh_known_hosts "syntaxi.net" do
- hashed true
- user 'vagrant'
-end
-
-
-ssh_config "syntaxi.net" do
- action :destroy
- user 'vagrant'
-end
-
-ssh_config "syntaxi2.net" do
- options 'User' => 'syntaxin'
- user 'vagrant'
-end
-
-ssh_config "github.com" do
- options 'User' => 'git', 'IdentityFile' => '~/.ssh/github_key'
- user 'vagrant'
-end
View
@@ -1,4 +1,4 @@
-actions :create, :destroy
+actions :add, :remove
default_action :create
attribute :host, :kind_of => String, :name_attribute => true
View
@@ -1,5 +1,5 @@
-actions :create
-default_action :create
+actions :add, :remove
+default_action :add
attribute :host, :kind_of => String, :name_attribute => true
attribute :hashed, :kind_of => [TrueClass, FalseClass], :default => TrueClass
@@ -9,5 +9,5 @@
def initialize(*args)
super
- @action = :create
+ @action = :add
end

0 comments on commit ad9fe41

Please sign in to comment.