Skip to content

Commit

Permalink
Add option to store machine data in node attribute rather than file.
Browse files Browse the repository at this point in the history
To use this option, specify a driver url of 'ssh:chef'

In support of above:
1. Some refactoring of driver.rb.
2. Fixes some warnings with gemspec.
3. Fixes tests for changed location of vagrant insecure key in vagrant 1.7+.
4. Updated readme for above and some out of date info.

Also fixes chef-boneyard#29 by using stored transport options if none specified, and
fixes chef-boneyard#25 so validation logic accepts windows :port
  • Loading branch information
christine_draper committed May 18, 2016
1 parent ef89ed0 commit 3fa00e0
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 145 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ test/.chef/provisioning
test/nodes
test/clients
test/.chef/local-mode-cache
.project
vendor/
Gemfile.lock
*.gem
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Chef::Provisioning::Ssh

TODO: Write a gem description
Provisions existing machines using SSH.

## Installation

Expand All @@ -22,13 +22,25 @@ Or install it yourself as:

## Usage

The `machine_options` for provisioning ssh now use the key `transport_options` which line up directly with the `transport_options` for chef-provisioning proper.
### driver_url

`with_driver 'ssh'` will store machine data in a file in the directory `.chef/provisioning/ssh`
on the provisioning machine, with a reference
to the file in the node attribute `node['chef_provisioning']['reference']['ssh_machine_file']`

The `transport_options` key must be a *symbol*.
`with_driver 'ssh:/some/path'` will store machine data in the specified directory, with a
reference to the file as above.

Sub-keys should be *strings*.
`with_driver 'ssh:chef'` will store all machine data in the node attribute
`node['chef_provisioning']['reference']`.

The transport_options can be viewed in the code for chef-provisioning here:
### machine_options

The `machine_options` for provisioning ssh now use the key `transport_options` which line up directly with the `transport_options` for chef-provisioning proper.

The `transport_options` key and sub-keys may be strings or symbols.

The `transport_options` can be viewed in the code for chef-provisioning here:

https://github.com/chef/chef-provisioning/blob/master/lib/chef/provisioning/transport/ssh.rb#L17-L34

Expand Down Expand Up @@ -161,7 +173,7 @@ In addition to host, ip_address and hostname are also additional options.

To test it out, clone the repo:

`git clone https://github.com/double-z/chef-provisioning-ssh.git`
`git clone https://github.com/chef/chef-provisioning-ssh.git`

in the test directory there is a Vagrantfile with 2 nodes.

Expand All @@ -175,17 +187,21 @@ Then run from the test directory:

`chef-client -z -o vagrant::test_ssh`

NOTE: if the second machine fails it will be a result of issues with your vagrant key.
NOTE: if the first machine fails it will likely be a result of issues with your vagrant key.

This will run chef-provisioning on each of the two vagrant nodes.

thats it.

party on wayne.

Be aware, the `test_ssh` recipe is designed for testing, not to illustrate good practice. For example, you
do not need to list all three actions `[ :ready, :setup, :converge ]` or specify `converge true`
if you want the normal 'bootstrap if needed, converge if changed' behavior.

## Contributing

1. Fork it ( http://github.com/double-z/chef-provisioning-ssh/fork )
1. Fork it ( http://github.com/chef/chef-provisioning-ssh/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
Expand Down
8 changes: 4 additions & 4 deletions chef-provisioning-ssh.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ Gem::Specification.new do |s|
s.extra_rdoc_files = ['README.md', 'LICENSE' ]
s.summary = 'Provisioner for managing servers using ssh in Chef Provisioning.'
s.description = s.summary
s.homepage = 'https://github.com/double-z/chef-provisioning-ssh'
s.homepage = 'https://github.com/chef/chef-provisioning-ssh'

s.require_path = "lib"
s.bindir = "bin"
s.executables = %w( )
s.files = %w(Rakefile LICENSE README.md Gemfile) + Dir.glob("*.gemspec") +
Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }

s.add_dependency 'chef-provisioning'
s.add_runtime_dependency 'chef-provisioning', "~> 1.0"

s.add_development_dependency "bundler", "~> 1.5"
s.add_development_dependency "rspec"
s.add_development_dependency "rake"
s.add_development_dependency "rspec", "~> 0"
s.add_development_dependency "rake", "~> 0"
end
Loading

0 comments on commit 3fa00e0

Please sign in to comment.