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
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 |
#dnsnames ⇒ Object
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 |
#groups ⇒ Object
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 |
#name ⇒ Object
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 |
#roles ⇒ Object
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 |