Class: SSH

Inherits:
StationModule
  • Object
show all
Defined in:
lib/vagrant/conductor/modules/ssh/ssh.rb

Instance Method Summary collapse

Instance Method Details

#authorizeObject



3
4
5
6
7
8
9
10
# File 'lib/vagrant/conductor/modules/ssh/ssh.rb', line 3

def authorize
  if args.find?('authorize', false)
    shell_provision(
        "echo $1 | tee -a /home/vagrant/.ssh/authorized_keys",
        [File.read(File.expand_path(args["authorize"]))]
    )
  end
end

#keysObject



12
13
14
15
16
17
18
19
20
# File 'lib/vagrant/conductor/modules/ssh/ssh.rb', line 12

def keys
  args.find?('keys', []).each do |key|
    shell_provision(
      "echo \"$1\" > /home/vagrant/.ssh/$2 && chmod 600 /home/vagrant/.ssh/$2",
      [File.read(File.expand_path(key)), key.split('/').last],
      false
    )
  end
end

#provisionObject



22
23
24
25
26
27
# File 'lib/vagrant/conductor/modules/ssh/ssh.rb', line 22

def provision
  # Configure The Public Key For SSH Access
  authorize
  # Copy The SSH Private Keys To The Box
  keys
end