lib/yun/model/ssh.rb in yun-0.0.4 vs lib/yun/model/ssh.rb in yun-0.0.5
- old
+ new
@@ -8,24 +8,27 @@
@host = host
@ssh_config = ssh_config
end
def connect
- exec "ssh -i #{key_file} #{user}@#{@host}"
+ ssh_command = "ssh -i #{key_file} #{user}@#{@host}"
+ puts ssh_command
+ exec ssh_command
end
def chef role
Net::SSH.start(@host, user, :keys => [key_file]) do |ssh|
- puts "installing chef"
- remote_command ssh, "bash /tmp/install_chef_file.sh"
-
puts "packaging chef repo"
tmp_chef_repo_tar = make_chef_repo_tar Config.chef_repo
puts "uploading chef repo"
ssh.scp.upload! tmp_chef_repo_tar, tmp_chef_repo_tar
ssh.scp.upload! install_chef_file, "/tmp/install_chef_file.sh"
ssh.scp.upload! chef_config_file, "/tmp/chef-solo.rb"
+
+ puts "installing chef"
+ remote_command ssh, "bash /tmp/install_chef_file.sh"
+
remote_command ssh, "echo {\\\"run_list\\\":\\\"role[#{role}]\\\"} > /tmp/node.json"
puts "executing chef"
remote_command ssh, "sudo chef-solo -c /tmp/chef-solo.rb -j /tmp/node.json -r /tmp/chef-solo.tar.gz"