Module: Chef
- Defined in:
- lib/open-dock/chef.rb
Class Method Summary collapse
- .cook(user, host) ⇒ Object
- .cook_container(user, container_name, host, ssh_port) ⇒ Object
- .install(user, host) ⇒ Object
Class Method Details
.cook(user, host) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/open-dock/chef.rb', line 16 def self.cook(user, host) say "Configuring #{host}, please wait ....\n" command = "knife solo cook #{user}@#{host}" say "Chef CMD: #{command}\n" system command end |
.cook_container(user, container_name, host, ssh_port) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/open-dock/chef.rb', line 23 def self.cook_container(user, container_name, host, ssh_port) say "Container '#{container_name}' configuring on #{host}, please wait ....\n" command = "knife solo cook #{user}@#{host} -p #{ssh_port} nodes/#{host}/#{container_name}.json" say "Chef CMD: #{command}\n" system command end |
.install(user, host) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/open-dock/chef.rb', line 3 def self.install(user, host) Net::SSH.start(host, user) do |ssh| if ssh.exec!('which chef-client') say 'Chef already installed' else say "Installing Chef, please wait ..." ssh.exec! 'apt-get -y update; \ apt-get -y install curl build-essential libxml2-dev libxslt-dev git ; \ curl -L https://www.opscode.com/chef/install.sh | bash' end end end |