Class: Rig::Template::Server
Instance Method Summary collapse
- #balancer(b = nil, &block) ⇒ Object
- #count(c = nil) ⇒ Object
- #dns(name) ⇒ Object
- #dnsnames ⇒ Object
- #flavor(f = nil) ⇒ Object
- #group(g) ⇒ Object
- #groups ⇒ Object
- #image(i = nil) ⇒ Object
-
#initialize(name) ⇒ Server
constructor
A new instance of Server.
- #keypair(k = nil) ⇒ Object
- #name ⇒ Object
- #role(r) ⇒ Object
- #roles ⇒ Object
- #userdata(u = nil) ⇒ Object
Methods inherited from Base
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
142 143 144 145 146 147 148 |
# File 'lib/rig/template.rb', line 142 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
118 119 120 |
# File 'lib/rig/template.rb', line 118 def count(c=nil) attr(:count, c) end |
#dns(name) ⇒ Object
150 151 152 153 |
# File 'lib/rig/template.rb', line 150 def dns(name) n = name.gsub(Rig.get_config(:dns_zone), "") list_attr(:dnsnames, n) end |
#dnsnames ⇒ Object
110 111 112 |
# File 'lib/rig/template.rb', line 110 def dnsnames @attrs[:dnsnames] end |
#flavor(f = nil) ⇒ Object
126 127 128 |
# File 'lib/rig/template.rb', line 126 def flavor(f=nil) attr(:flavor, f) end |
#group(g) ⇒ Object
130 131 132 |
# File 'lib/rig/template.rb', line 130 def group(g) list_attr(:groups, g) end |
#groups ⇒ Object
107 108 109 |
# File 'lib/rig/template.rb', line 107 def groups @attrs[:groups] end |
#image(i = nil) ⇒ Object
122 123 124 |
# File 'lib/rig/template.rb', line 122 def image(i=nil) attr(:image, i) end |
#keypair(k = nil) ⇒ Object
134 135 136 |
# File 'lib/rig/template.rb', line 134 def keypair(k=nil) attr(:keypair, k) end |
#name ⇒ Object
101 102 103 |
# File 'lib/rig/template.rb', line 101 def name @attrs[:name] end |
#role(r) ⇒ Object
114 115 116 |
# File 'lib/rig/template.rb', line 114 def role(r) list_attr(:roles, r) end |
#roles ⇒ Object
104 105 106 |
# File 'lib/rig/template.rb', line 104 def roles @attrs[:roles] end |
#userdata(u = nil) ⇒ Object
138 139 140 |
# File 'lib/rig/template.rb', line 138 def userdata(u=nil) attr(:userdata, u) end |