Class: PoolParty::Plugin::Sshkey

Inherits:
PoolParty::Plugin show all
Defined in:
lib/poolparty/plugins/sshkey.rb

Overview

Ssh Key

The sshkey resource specifies an ssh key that should be distributed on all the nodes

Usage

has_sshkey(:key => '...') do
  # More options. 
  # This block is optional
end

Options

  • key The key content for the ssh key

  • name The location of the ssh key

Examples

has_sshkey(:key => "ABIGLONGSTRINGOFDIGETS", :name => "/root/.ssh/key_file")

Instance Method Summary collapse

Methods included from PoolParty::Plugin

available

Constructor Details

#initialize(opts = {}, extra_opts = {}, &block) ⇒ Sshkey

Returns a new instance of Sshkey.



35
36
37
38
39
# File 'lib/poolparty/plugins/sshkey.rb', line 35

def initialize(opts={}, extra_opts={}, &block)
  super(opts, extra_opts, &block)
  @key = Key.new(keypath ? keypath : nil)
  self.key = @key.content
end

Instance Method Details

#loaded(opts = {}, &block) ⇒ Object



41
42
43
44
# File 'lib/poolparty/plugins/sshkey.rb', line 41

def loaded(opts={}, &block)
  has_directory(::File.dirname(opts[:name]))
  has_file(:name => opts[:name], :content => opts[:content], :mode => opts[:mode])
end