class Skirnir::Node
Attributes
chef[RW]
ip_ext[RW]
ip_int[RW]
name[RW]
roles[RW]
run_list[RW]
Public Class Methods
new(site_name, config)
click to toggle source
# File lib/skirnir/node.rb, line 4 def initialize(site_name, config) @name = config['name'] @roles = config['roles'] @run_list = @roles.map{|role| "recipe[#{site_name}::#{role}_box]"} @ip_int = config['ip_int'] @ip_ext = config['ip_ext'] || @ip_int chef_config = config['chef'] || {} @chef = Skirnir::Chef.new({'all' => chef_config}) to_h.each_pair do |key, value| @chef.set('all', 'box', key, value) end end
Public Instance Methods
chef_hash()
click to toggle source
returns the chef definitions specific for this node
# File lib/skirnir/node.rb, line 36 def chef_hash @chef.get_for_roles('all') end
has_role?(role)
click to toggle source
# File lib/skirnir/node.rb, line 21 def has_role?(role) @roles.include? role end
to_h()
click to toggle source
@return [Hash]
# File lib/skirnir/node.rb, line 26 def to_h { 'name' => @name, 'roles' => @roles, 'ip_int' => @ip_int, 'ip_ext' => @ip_ext } end