Class: VagrantPlugins::VCloud::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::VCloud::Config
- Defined in:
- lib/vagrant-vcloud/config.rb
Instance Attribute Summary collapse
-
#add_hdds ⇒ Object
Add hard disks to the VM (Array) add_hdds: [ 20480 ].
-
#advanced_network ⇒ Object
Use advanced networking settings (Bool = false).
-
#auto_yes_for_upload ⇒ Object
Auto answer “Yes” to upload the box to vCloud (Bool = false).
-
#catalog ⇒ Object
catalog object (Hash).
-
#catalog_id ⇒ Object
catalog id (String).
-
#catalog_item ⇒ Object
catalog item object (Hash).
-
#catalog_item_name ⇒ String
Catalog Item to be used as a template.
-
#catalog_name ⇒ String
Catalog Name where the item resides.
-
#cpus ⇒ Object
VM number of cpus (Integer).
-
#dhcp_enabled ⇒ Object
Turn DHCP on for this network (Bool = false).
-
#dhcp_range ⇒ Object
DHCP ip range if enabled (Array).
-
#enable_guest_customization ⇒ Object
ability to disable gc for vms without tools installed.
-
#guest_customization_admin_auto_login ⇒ Object
guest customization admin auto login (Windows only) (Bool = false).
-
#guest_customization_admin_auto_login_count ⇒ Object
guest customization admin auto login count (Windows only) (Integer).
-
#guest_customization_admin_password ⇒ Object
guest customization specify admin password (String).
-
#guest_customization_admin_password_auto ⇒ Object
guest customization auto generate admin password (Bool = false).
-
#guest_customization_admin_password_enabled ⇒ Object
guest customization local admin (Bool = false).
-
#guest_customization_admin_password_reset ⇒ Object
guest customization admin require password reset (Bool = false).
-
#guest_customization_change_sid ⇒ Object
guest customization change sid setting (Windows only) (Bool = false).
-
#guest_customization_domain_name ⇒ Object
guest customization domain name (Windows only) (String).
-
#guest_customization_domain_ou ⇒ Object
guest customization domain machine ou (Windows only) (String).
-
#guest_customization_domain_user_name ⇒ Object
guest customization domain user name (Windows only) (String).
-
#guest_customization_domain_user_password ⇒ Object
guest customization domain user password (Windows only) (String).
-
#guest_customization_join_domain ⇒ Object
guest customization join domain (Windows only) (Bool = false).
-
#guest_customization_script ⇒ Object
scripts to run on machine boot.
-
#hostname ⇒ String
The vCloud Director hostname.
-
#ip_allocation_type ⇒ String
IP allocation type.
-
#ip_dns ⇒ Array
DNS.
-
#ip_subnet ⇒ String
IP subnet.
-
#memory ⇒ Object
VM memory size in MB (Integer).
-
#metadata_vapp ⇒ Object
Add metadata to the vApp (Array) metadata_vapp: [ [ ‘key’, ‘value’ ] ].
-
#metadata_vm ⇒ Object
Add metadata to the VM (Array) metadata_vapp: [ [ ‘key’, ‘value’ ] ].
-
#name ⇒ String
Name of the VM [optional].
-
#nested_hypervisor ⇒ Object
NestedHypervisor (Bool).
-
#network_bridge ⇒ Bool
Bridge Mode.
-
#networks ⇒ Object
Specify networks to add to the vApp (Hash) networks: { org: [ ‘Organization VDC network’ ], vapp: [ { name: ‘vApp network’, ip_subnet: ‘172.16.4.0/255.255.255.0’ } ] }.
-
#nics ⇒ Object
Update / add network cards to the VM (Array) type is not updated for existing network cards nics: [ { type: :vmxnet3, connected: true, network: “vApp network”, primary: true, ip_mode: “static”, ip: “10.10.10.1”, mac: “00:50:56:00:00:01” } ].
-
#org ⇒ Object
org object (Hash).
-
#org_id ⇒ Object
org id (String).
-
#org_name ⇒ String
The Organization Name to log in to.
-
#ovf_properties ⇒ Object
ovf properties object (Hash).
-
#password ⇒ String
The password used to log in.
-
#pool_range ⇒ Object
POOL ip range if dhcp is enabled (Array).
-
#port_forwarding_rules ⇒ Hash
readonly
Port forwarding rules.
-
#power_on ⇒ Object
Power on the VM once created (Bool = true).
-
#ssh_enabled ⇒ Object
Attempt to connect via SSH to the VM (Bool = true).
-
#sync_enabled ⇒ Object
Attempt to sync files to the VM (Bool = true).
-
#upload_chunksize ⇒ Integer
Chunksize for upload in bytes (default 1048576 == 1M).
-
#username ⇒ String
The username used to log in.
-
#vapp_name ⇒ Object
Specify a vApp name (String).
-
#vapp_prefix ⇒ String
Name of the vApp prefix [optional, defaults to ‘Vagrant’ ].
-
#vAppId ⇒ Object
vApp Id (String).
-
#vAppName ⇒ Object
vApp Name (String).
-
#vcloud_cnx ⇒ Object
connection handle.
-
#vdc ⇒ Object
vdc object (Hash).
-
#vdc_edge_gateway ⇒ String
Name of the edge gateway [optional].
-
#vdc_edge_gateway_ip ⇒ String
Public IP of the edge gateway [optional, required if :vdc_edge_gateway is specified].
-
#vdc_id ⇒ Object
vdc id (String).
-
#vdc_name ⇒ String
Virtual Data Center to be used.
-
#vdc_network_id ⇒ String
Virtual Data Center Network Id to be used.
-
#vdc_network_name ⇒ String
Virtual Data Center Network to be used.
Instance Method Summary collapse
Instance Attribute Details
#add_hdds ⇒ Object
Add hard disks to the VM (Array)
add_hdds: [ 20480 ]
169 170 171 |
# File 'lib/vagrant-vcloud/config.rb', line 169 def add_hdds @add_hdds end |
#advanced_network ⇒ Object
Use advanced networking settings (Bool = false)
153 154 155 |
# File 'lib/vagrant-vcloud/config.rb', line 153 def advanced_network @advanced_network end |
#auto_yes_for_upload ⇒ Object
Auto answer “Yes” to upload the box to vCloud (Bool = false)
218 219 220 |
# File 'lib/vagrant-vcloud/config.rb', line 218 def auto_yes_for_upload @auto_yes_for_upload end |
#catalog ⇒ Object
catalog object (Hash)
126 127 128 |
# File 'lib/vagrant-vcloud/config.rb', line 126 def catalog @catalog end |
#catalog_id ⇒ Object
catalog id (String)
129 130 131 |
# File 'lib/vagrant-vcloud/config.rb', line 129 def catalog_id @catalog_id end |
#catalog_item ⇒ Object
catalog item object (Hash)
132 133 134 |
# File 'lib/vagrant-vcloud/config.rb', line 132 def catalog_item @catalog_item end |
#catalog_item_name ⇒ String
Catalog Item to be used as a template
38 39 40 |
# File 'lib/vagrant-vcloud/config.rb', line 38 def catalog_item_name @catalog_item_name end |
#catalog_name ⇒ String
Catalog Name where the item resides
33 34 35 |
# File 'lib/vagrant-vcloud/config.rb', line 33 def catalog_name @catalog_name end |
#cpus ⇒ Object
VM number of cpus (Integer)
144 145 146 |
# File 'lib/vagrant-vcloud/config.rb', line 144 def cpus @cpus end |
#dhcp_enabled ⇒ Object
Turn DHCP on for this network (Bool = false)
195 196 197 |
# File 'lib/vagrant-vcloud/config.rb', line 195 def dhcp_enabled @dhcp_enabled end |
#dhcp_range ⇒ Object
DHCP ip range if enabled (Array)
201 202 203 |
# File 'lib/vagrant-vcloud/config.rb', line 201 def dhcp_range @dhcp_range end |
#enable_guest_customization ⇒ Object
ability to disable gc for vms without tools installed
221 222 223 |
# File 'lib/vagrant-vcloud/config.rb', line 221 def enable_guest_customization @enable_guest_customization end |
#guest_customization_admin_auto_login ⇒ Object
guest customization admin auto login (Windows only) (Bool = false)
254 255 256 |
# File 'lib/vagrant-vcloud/config.rb', line 254 def guest_customization_admin_auto_login @guest_customization_admin_auto_login end |
#guest_customization_admin_auto_login_count ⇒ Object
guest customization admin auto login count (Windows only) (Integer)
257 258 259 |
# File 'lib/vagrant-vcloud/config.rb', line 257 def guest_customization_admin_auto_login_count @guest_customization_admin_auto_login_count end |
#guest_customization_admin_password ⇒ Object
guest customization specify admin password (String)
251 252 253 |
# File 'lib/vagrant-vcloud/config.rb', line 251 def guest_customization_admin_password @guest_customization_admin_password end |
#guest_customization_admin_password_auto ⇒ Object
guest customization auto generate admin password (Bool = false)
248 249 250 |
# File 'lib/vagrant-vcloud/config.rb', line 248 def guest_customization_admin_password_auto @guest_customization_admin_password_auto end |
#guest_customization_admin_password_enabled ⇒ Object
guest customization local admin (Bool = false)
245 246 247 |
# File 'lib/vagrant-vcloud/config.rb', line 245 def guest_customization_admin_password_enabled @guest_customization_admin_password_enabled end |
#guest_customization_admin_password_reset ⇒ Object
guest customization admin require password reset (Bool = false)
263 264 265 |
# File 'lib/vagrant-vcloud/config.rb', line 263 def guest_customization_admin_password_reset @guest_customization_admin_password_reset end |
#guest_customization_change_sid ⇒ Object
guest customization change sid setting (Windows only) (Bool = false)
227 228 229 |
# File 'lib/vagrant-vcloud/config.rb', line 227 def guest_customization_change_sid @guest_customization_change_sid end |
#guest_customization_domain_name ⇒ Object
guest customization domain name (Windows only) (String)
233 234 235 |
# File 'lib/vagrant-vcloud/config.rb', line 233 def guest_customization_domain_name @guest_customization_domain_name end |
#guest_customization_domain_ou ⇒ Object
guest customization domain machine ou (Windows only) (String)
242 243 244 |
# File 'lib/vagrant-vcloud/config.rb', line 242 def guest_customization_domain_ou @guest_customization_domain_ou end |
#guest_customization_domain_user_name ⇒ Object
guest customization domain user name (Windows only) (String)
236 237 238 |
# File 'lib/vagrant-vcloud/config.rb', line 236 def guest_customization_domain_user_name @guest_customization_domain_user_name end |
#guest_customization_domain_user_password ⇒ Object
guest customization domain user password (Windows only) (String)
239 240 241 |
# File 'lib/vagrant-vcloud/config.rb', line 239 def guest_customization_domain_user_password @guest_customization_domain_user_password end |
#guest_customization_join_domain ⇒ Object
guest customization join domain (Windows only) (Bool = false)
230 231 232 |
# File 'lib/vagrant-vcloud/config.rb', line 230 def guest_customization_join_domain @guest_customization_join_domain end |
#guest_customization_script ⇒ Object
scripts to run on machine boot
224 225 226 |
# File 'lib/vagrant-vcloud/config.rb', line 224 def guest_customization_script @guest_customization_script end |
#hostname ⇒ String
The vCloud Director hostname
11 12 13 |
# File 'lib/vagrant-vcloud/config.rb', line 11 def hostname @hostname end |
#ip_allocation_type ⇒ String
IP allocation type
63 64 65 |
# File 'lib/vagrant-vcloud/config.rb', line 63 def ip_allocation_type @ip_allocation_type end |
#ip_dns ⇒ Array
DNS
73 74 75 |
# File 'lib/vagrant-vcloud/config.rb', line 73 def ip_dns @ip_dns end |
#ip_subnet ⇒ String
IP subnet
68 69 70 |
# File 'lib/vagrant-vcloud/config.rb', line 68 def ip_subnet @ip_subnet end |
#memory ⇒ Object
VM memory size in MB (Integer)
141 142 143 |
# File 'lib/vagrant-vcloud/config.rb', line 141 def memory @memory end |
#metadata_vapp ⇒ Object
Add metadata to the vApp (Array)
metadata_vapp: [
[ 'key', 'value' ]
]
208 209 210 |
# File 'lib/vagrant-vcloud/config.rb', line 208 def @metadata_vapp end |
#metadata_vm ⇒ Object
Add metadata to the VM (Array)
metadata_vapp: [
[ 'key', 'value' ]
]
215 216 217 |
# File 'lib/vagrant-vcloud/config.rb', line 215 def @metadata_vm end |
#name ⇒ String
Name of the VM [optional]
104 105 106 |
# File 'lib/vagrant-vcloud/config.rb', line 104 def name @name end |
#nested_hypervisor ⇒ Object
NestedHypervisor (Bool)
147 148 149 |
# File 'lib/vagrant-vcloud/config.rb', line 147 def nested_hypervisor @nested_hypervisor end |
#network_bridge ⇒ Bool
Bridge Mode
78 79 80 |
# File 'lib/vagrant-vcloud/config.rb', line 78 def network_bridge @network_bridge end |
#networks ⇒ Object
Specify networks to add to the vApp (Hash)
networks: {
org: [ 'Organization VDC network' ],
vapp: [ {
name: 'vApp network',
ip_subnet: '172.16.4.0/255.255.255.0'
} ]
}
164 165 166 |
# File 'lib/vagrant-vcloud/config.rb', line 164 def networks @networks end |
#nics ⇒ Object
Update / add network cards to the VM (Array) type is not updated for existing network cards
nics: [ {
type: :vmxnet3,
connected: true,
network: "vApp network",
primary: true,
ip_mode: "static",
ip: "10.10.10.1",
mac: "00:50:56:00:00:01"
} ]
183 184 185 |
# File 'lib/vagrant-vcloud/config.rb', line 183 def nics @nics end |
#org ⇒ Object
org object (Hash)
114 115 116 |
# File 'lib/vagrant-vcloud/config.rb', line 114 def org @org end |
#org_id ⇒ Object
org id (String)
117 118 119 |
# File 'lib/vagrant-vcloud/config.rb', line 117 def org_id @org_id end |
#org_name ⇒ String
The Organization Name to log in to
16 17 18 |
# File 'lib/vagrant-vcloud/config.rb', line 16 def org_name @org_name end |
#ovf_properties ⇒ Object
ovf properties object (Hash)
266 267 268 |
# File 'lib/vagrant-vcloud/config.rb', line 266 def ovf_properties @ovf_properties end |
#password ⇒ String
The password used to log in
26 27 28 |
# File 'lib/vagrant-vcloud/config.rb', line 26 def password @password end |
#pool_range ⇒ Object
POOL ip range if dhcp is enabled (Array)
198 199 200 |
# File 'lib/vagrant-vcloud/config.rb', line 198 def pool_range @pool_range end |
#port_forwarding_rules ⇒ Hash (readonly)
Port forwarding rules
83 84 85 |
# File 'lib/vagrant-vcloud/config.rb', line 83 def port_forwarding_rules @port_forwarding_rules end |
#power_on ⇒ Object
Power on the VM once created (Bool = true)
186 187 188 |
# File 'lib/vagrant-vcloud/config.rb', line 186 def power_on @power_on end |
#ssh_enabled ⇒ Object
Attempt to connect via SSH to the VM (Bool = true)
189 190 191 |
# File 'lib/vagrant-vcloud/config.rb', line 189 def ssh_enabled @ssh_enabled end |
#sync_enabled ⇒ Object
Attempt to sync files to the VM (Bool = true)
192 193 194 |
# File 'lib/vagrant-vcloud/config.rb', line 192 def sync_enabled @sync_enabled end |
#upload_chunksize ⇒ Integer
Chunksize for upload in bytes (default 1048576 == 1M)
43 44 45 |
# File 'lib/vagrant-vcloud/config.rb', line 43 def upload_chunksize @upload_chunksize end |
#username ⇒ String
The username used to log in
21 22 23 |
# File 'lib/vagrant-vcloud/config.rb', line 21 def username @username end |
#vapp_name ⇒ Object
Specify a vApp name (String)
150 151 152 |
# File 'lib/vagrant-vcloud/config.rb', line 150 def vapp_name @vapp_name end |
#vapp_prefix ⇒ String
Name of the vApp prefix [optional, defaults to ‘Vagrant’ ]
99 100 101 |
# File 'lib/vagrant-vcloud/config.rb', line 99 def vapp_prefix @vapp_prefix end |
#vAppId ⇒ Object
vApp Id (String)
138 139 140 |
# File 'lib/vagrant-vcloud/config.rb', line 138 def vAppId @vAppId end |
#vAppName ⇒ Object
vApp Name (String)
135 136 137 |
# File 'lib/vagrant-vcloud/config.rb', line 135 def vAppName @vAppName end |
#vcloud_cnx ⇒ Object
connection handle
111 112 113 |
# File 'lib/vagrant-vcloud/config.rb', line 111 def vcloud_cnx @vcloud_cnx end |
#vdc ⇒ Object
vdc object (Hash)
120 121 122 |
# File 'lib/vagrant-vcloud/config.rb', line 120 def vdc @vdc end |
#vdc_edge_gateway ⇒ String
Name of the edge gateway [optional]
88 89 90 |
# File 'lib/vagrant-vcloud/config.rb', line 88 def vdc_edge_gateway @vdc_edge_gateway end |
#vdc_edge_gateway_ip ⇒ String
Public IP of the edge gateway [optional, required if :vdc_edge_gateway is specified]
94 95 96 |
# File 'lib/vagrant-vcloud/config.rb', line 94 def vdc_edge_gateway_ip @vdc_edge_gateway_ip end |
#vdc_id ⇒ Object
vdc id (String)
123 124 125 |
# File 'lib/vagrant-vcloud/config.rb', line 123 def vdc_id @vdc_id end |
#vdc_name ⇒ String
Virtual Data Center to be used
48 49 50 |
# File 'lib/vagrant-vcloud/config.rb', line 48 def vdc_name @vdc_name end |
#vdc_network_id ⇒ String
Virtual Data Center Network Id to be used
58 59 60 |
# File 'lib/vagrant-vcloud/config.rb', line 58 def vdc_network_id @vdc_network_id end |
#vdc_network_name ⇒ String
Virtual Data Center Network to be used
53 54 55 |
# File 'lib/vagrant-vcloud/config.rb', line 53 def vdc_network_name @vdc_network_name end |
Instance Method Details
#validate(machine) ⇒ Object
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/vagrant-vcloud/config.rb', line 268 def validate(machine) errors = _detected_errors # TODO: add blank? errors << I18n.t('vagrant_vcloud.config.hostname') if hostname.nil? errors << I18n.t('vagrant_vcloud.config.org_name') if org_name.nil? errors << I18n.t('vagrant_vcloud.config.username') if username.nil? errors << I18n.t('vagrant_vcloud.config.password') if password.nil? unless ip_dns.nil? unless ip_dns.kind_of?(Array) errors << I18n.t('vagrant_vcloud.config.ip_dns') end end if catalog_name.nil? errors << I18n.t('vagrant_vcloud.config.catalog_name') end if vdc_name.nil? errors << I18n.t('vagrant_vcloud.config.vdc_name') end if networks.nil? && vdc_network_name.nil? errors << I18n.t('vagrant_vcloud.config.vdc_network_name') end # guest customization if enable_guest_customization.nil? || enable_guest_customization == false if guest_customization_change_sid == true errors << I18n.t('vagrant_vcloud.gc.change_sid') end if !guest_customization_admin_password_enabled.nil? errors << I18n.t('vagrant_vcloud.gc.admin_password') end if !guest_customization_admin_password_reset.nil? errors << I18n.t('vagrant_vcloud.gc.admin_password_reset') end if !guest_customization_script.nil? errors << I18n.t('vagrant_vcloud.gc.script') end else if guest_customization_change_sid.nil? || guest_customization_change_sid == false if guest_customization_join_domain == true errors << I18n.t('vagrant_vcloud.gc.domain') end else if guest_customization_join_domain == true if guest_customization_domain_name.nil? || guest_customization_domain_user_name.nil? || guest_customization_domain_user_password.nil? errors << I18n.t('vagrant_vcloud.gc.domain_join') end end end if guest_customization_admin_password_enabled.nil? || guest_customization_admin_password_enabled == false if guest_customization_admin_auto_login == true errors << I18n.t('vagrant_vcloud.gc.auto_login') end else if guest_customization_admin_auto_login == true if guest_customization_admin_password_auto.nil? || guest_customization_admin_password_auto == false if guest_customization_admin_password.nil? || guest_customization_admin_password.empty? errors << I18n.t('vagrant_vcloud.gc.admin_password_gs') end end if guest_customization_admin_auto_login_count.nil? errors << I18n.t('vagrant_vcloud.gc.auto_login_count_req') else if !( guest_customization_admin_auto_login_count >= 1 && guest_customization_admin_auto_login_count <= 100 ) errors << I18n.t('vagrant_vcloud.gc.auto_login_count') end end end end end { 'vCloud Provider' => errors } end |