You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-52Lines changed: 50 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,64 +20,60 @@ This Terraform module deploys single or multiple virtual machines of type (Linux
20
20
21
21
> Note: For module to work it needs number of required variables corresponding to an existing resources in vSphere. Please refer to variable section for the list of required variables.
22
22
23
-
## Usage
23
+
## Getting started
24
24
25
25
Following example contains the bare minimum options to be configured for (Linux/Windows) VM deployment. You can choose between windows and linux customization by simply using the ´is_windows_image´ boolean switch.
26
26
27
27
You can also download the entire module and use your own predefined variables to map your entire vSphere environment and use it within this module.
28
28
29
+
__Create a main.tf file and copy the following code. fill the required data and run terraform plan.__
30
+
29
31
```hcl
32
+
33
+
# Configure the VMware vSphere Provider
34
+
provider "vsphere" {
35
+
user = "fill"
36
+
password = "fill"
37
+
vsphere_server = "fill"
38
+
39
+
# if you have a self-signed cert
40
+
allow_unverified_ssl = true
41
+
}
42
+
43
+
# Deploy 2 linux VMs
30
44
module "example-server-linuxvm" {
31
45
source = "Terraform-VMWare-Modules/vm/vsphere"
32
46
version = "X.X.X"
33
-
vmtemp = "TemplateName"
34
-
instances = 1
47
+
vmtemp = "VM Template Name (Should Alrerady exist)"
48
+
instances = 2
35
49
vmname = "example-server-linux"
36
-
vmrp = "esxi/Resources"
37
-
network_cards = ["Name of the Port Group in vSphere"]
38
-
ipv4 = {
39
-
"Name of the Port Group in vSphere" = ["10.0.0.1"] # To use DHCP create Empty list for each instance
50
+
vmrp = "esxi/Resources - or name of a resource pool"
51
+
network = {
52
+
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
40
53
}
54
+
vmgateway = "10.13.113.1"
41
55
dc = "Datacenter"
42
56
datastore = "Data Store name(use ds_cluster for datastore cluster)"
43
57
}
44
58
45
-
module "example-server-windowsvm" {
46
-
source = "Terraform-VMWare-Modules/vm/vsphere"
47
-
version = "X.X.X"
48
-
vmtemp = "TemplateName"
49
-
is_windows_image = true
50
-
instances = 1
51
-
vmname = "example-server-windows"
52
-
vmrp = "esxi/Resources"
53
-
network_cards = ["Name of the Port Group in vSphere"]
54
-
ipv4 = {
55
-
"Name of the Port Group in vSphere" = ["10.0.0.1"] # To use DHCP create Empty list for each instance
56
-
}
57
-
dc = "Datacenter"
58
-
datastore = "Data Store name(use ds_cluster for datastore cluster)"
59
-
}
60
59
```
61
60
62
-
> Note: When deploying a windows server in WorkGroup, we recommend to keep the Local Admin password set to its default and change it later via an script. Unfortunately Terraform redeploy the entire server if you change the local admin password within your code.
63
-
64
61
## Advance Usage
65
62
66
63
There are number of switches defined in the module, where you can use to enable different features for VM provisioning.
67
64
68
65
### Main Feature Switches
69
66
70
67
- You can use `is_windows_image = true` to set the customization type to Windows (By default it is set to Linux customization)
71
-
- You can use `data_disk_size_gb = [20,30]` to add additional data disks (Supported in both Linux and Windows deployment)
72
-
- Above switch will create two additional disk of capacity 10 and 30gb for the VM.
73
-
- You can include `thin_provisioned` switch to define disk type for each additional disk.
74
68
- You can use `windomain = "somedomain.com"` to join a windows server to AD domain.
75
69
- Requires following additional variables
76
70
-`domainuser` Domain account with necessary privileges to join a computer to the domain.
77
71
-`domainpass` Domain user password.
78
72
-`is_windows_image` needs to be set to `true` to force the module to use Windows customization.
79
73
80
-
Below is an example of windows deployment with some of the available feature sets.
74
+
> Note: When deploying a windows server in WorkGroup, we recommend to keep the Local Admin password set to its default and change it later via an script. Unfortunately Terraform redeploy the entire server if you change the local admin password within your code.
75
+
76
+
Below is an example of windows deployment with some of the available feature sets. For complete list of available features refer to [variable.tf](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/blob/master/variables.tf)
0 commit comments