Class: Rig::Template::Server

Inherits:
Base
  • Object
show all
Defined in:
lib/rig/template.rb

Instance Method Summary collapse

Methods inherited from Base

#attr, #list_attr

Constructor Details

#initialize(name) ⇒ Server

Returns a new instance of Server.



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/rig/template.rb', line 87

def initialize(name)
  @attrs = {
      :name     => name.to_sym,
      :roles    => [],
      :groups   => [],
      :count    => 1,
      :image    => nil,
      :flavor   => nil,
      :keypair  => nil,
      :userdata => "default",
      :dnsnames => [],
  }
end

Instance Method Details

#balancer(b = nil, &block) ⇒ Object



145
146
147
148
149
150
151
# File 'lib/rig/template.rb', line 145

def balancer(b=nil, &block)
  if block_given?
    raise "balancer block must specify name" unless b
    Rig::Template::DSL.balancer(b, &block)
  end
  attr(:balancer, b)
end

#count(c = nil) ⇒ Object



121
122
123
# File 'lib/rig/template.rb', line 121

def count(c=nil)
  attr(:count, c)
end

#dns(name) ⇒ Object



153
154
155
156
# File 'lib/rig/template.rb', line 153

def dns(name)
  n = name.gsub(Rig.get_config(:dns_zone), "")
  list_attr(:dnsnames, n)
end

#dnsnamesObject



113
114
115
# File 'lib/rig/template.rb', line 113

def dnsnames
  @attrs[:dnsnames]
end

#flavor(f = nil) ⇒ Object



129
130
131
# File 'lib/rig/template.rb', line 129

def flavor(f=nil)
  attr(:flavor, f)
end

#group(g) ⇒ Object



133
134
135
# File 'lib/rig/template.rb', line 133

def group(g)
  list_attr(:groups, g)
end

#groupsObject



109
110
111
# File 'lib/rig/template.rb', line 109

def groups
  @attrs[:groups]
end

#image(i = nil) ⇒ Object



125
126
127
# File 'lib/rig/template.rb', line 125

def image(i=nil)
  attr(:image, i)
end

#keypair(k = nil) ⇒ Object



137
138
139
# File 'lib/rig/template.rb', line 137

def keypair(k=nil)
  attr(:keypair, k)
end

#nameObject



101
102
103
# File 'lib/rig/template.rb', line 101

def name
  @attrs[:name]
end

#role(r) ⇒ Object



117
118
119
# File 'lib/rig/template.rb', line 117

def role(r)
  list_attr(:roles, r)
end

#rolesObject



105
106
107
# File 'lib/rig/template.rb', line 105

def roles
  @attrs[:roles]
end

#userdata(u = nil) ⇒ Object



141
142
143
# File 'lib/rig/template.rb', line 141

def userdata(u=nil)
  attr(:userdata, u)
end