Skip to content

Commit

Permalink
0.9.5.3
Browse files Browse the repository at this point in the history
Added random number element to Proxy VM and Machine Name to allow overlapping instances to be run (allowing for future DHCP support) and not have conflicts.
  • Loading branch information
anthonyspiteri committed Oct 6, 2019
1 parent 1b508c8 commit 97e615e
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 12 deletions.
8 changes: 4 additions & 4 deletions project_otosukeru/README.md
Expand Up @@ -32,7 +32,7 @@ There is a master PowerShell script that executes all the code as does the follo
* Should be run from VBR Server to ensure Console Versions are compatible
* Require Execution Policy set to Bypass - Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

#### Version 0.9.5.2
#### Version 0.9.5.3
> 0.2 - First pre release for testing
> 0.4 - Added support for Linux Server to be added and removed to VBR Inventory in preperation for v10 Proxy PowerShell
Expand All @@ -49,6 +49,8 @@ There is a master PowerShell script that executes all the code as does the follo
> 0.9.5.2 - Added error checking for Proxy Server VBR configuration when adding managed server
> 0.9.5.3 - Added random number element to Proxy VM and Machine Name to allow overlapping instances to be run (allowing for future DHCP support) and not have conflicts.
## Getting Started

Ensure all configuration variables are set as per requirements and as per below.
Expand Down Expand Up @@ -123,7 +125,6 @@ The following variables can be adjusted dependant on installation vSphere platfo

vsphere_datacenter = "VC03"
vsphere_vm_folder = "TPM03-AS"
vsphere_vm_name = "VBR-PROXY-"
vsphere_vm_resource_pool ="TPM03-AS"
vsphere_vm_template = "TPM03-AS/WIN2K19-TEST"
vsphere_vm_firmware = "efi"
Expand All @@ -145,11 +146,10 @@ The following variables can be adjusted dependant on installation vSphere platfo

### VM specifications Windows (proxy_linux)

The following variables can be adjusted dependant on installation vSphere platform. The ones to look out for that could cause issues is the vm_firmware and vm_tags variables. The vm_template and vm_firmware need to be noted depending on Windows or Linux configuration.
The following variables can be adjusted dependant on installation vSphere platform. The ones to look out for that could cause issues is the vm_firmware and vm_tags variables. The vm_firmware need to be noted depending on Windows or Linux configuration.

vsphere_datacenter = "VC03"
vsphere_vm_folder = "TPM03-AS"
vsphere_vm_name = "VBR-PROXY-"
vsphere_vm_resource_pool ="TPM03-AS"
vsphere_vm_firmware = "bios"
vsphere_cluster = "MEGA-03"
Expand Down
7 changes: 7 additions & 0 deletions project_otosukeru/proxy_linux/main.tf
Expand Up @@ -41,3 +41,10 @@ data "vsphere_tag" "tag" {
name = "${var.vsphere_tag_name}"
category_id = "${data.vsphere_tag_category.category.id}"
}
provider "random" {
version="2.0"
}
resource "random_integer" "priority" {
min = 10
max = 99
}
4 changes: 2 additions & 2 deletions project_otosukeru/proxy_linux/otosukeru-1.tf
Expand Up @@ -7,7 +7,7 @@
resource "vsphere_virtual_machine" "VBR-PROXY" {
# VM placement #
count = "${var.vsphere_proxy_number}"
name = "${var.vsphere_vm_name}L${count.index + 1}"
name = "${var.vsphere_vm_name}-L${random_integer.priority.result}-${count.index + 1}"
resource_pool_id = "${data.vsphere_resource_pool.resource_pool.id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
folder = "${var.vsphere_vm_folder}"
Expand Down Expand Up @@ -38,7 +38,7 @@ resource "vsphere_virtual_machine" "VBR-PROXY" {

customize {
linux_options {
host_name = "${var.vsphere_vm_name}L${count.index + 1}"
host_name = "${var.vsphere_vm_name}-L${random_integer.priority.result}-${count.index + 1}"
domain = "${var.vsphere_domain}"
#time_zone = "${var.vsphere_time_zone}"
}
Expand Down
1 change: 0 additions & 1 deletion project_otosukeru/proxy_linux/terraform.tfvars
Expand Up @@ -12,7 +12,6 @@ vsphere_ad_password = "password$12"
# VM specifications
vsphere_datacenter = "VC03"
vsphere_vm_folder = "TPM03-AS"
vsphere_vm_name = "VBR-PROXY-"
vsphere_vm_resource_pool ="TPM03-AS"
vsphere_vm_firmware = "bios"
vsphere_cluster = "MEGA-03"
Expand Down
3 changes: 2 additions & 1 deletion project_otosukeru/proxy_linux/variables.tf
Expand Up @@ -33,7 +33,8 @@ variable "vsphere_datacenter" {
}

variable "vsphere_vm_name" {
description = "What is the name of the VM"
description = "What is the name of the VM - Should be no more than 7 characters long"
default = "VBR-PRX"
}

variable "vsphere_vm_firmware" {
Expand Down
8 changes: 8 additions & 0 deletions project_otosukeru/proxy_windows/main.tf
Expand Up @@ -41,3 +41,11 @@ data "vsphere_tag" "tag" {
name = "${var.vsphere_tag_name}"
category_id = "${data.vsphere_tag_category.category.id}"
}

provider "random" {
version="2.0"
}
resource "random_integer" "priority" {
min = 10
max = 99
}
4 changes: 2 additions & 2 deletions project_otosukeru/proxy_windows/otosukeru-1.tf
Expand Up @@ -7,7 +7,7 @@
resource "vsphere_virtual_machine" "VBR-PROXY" {
# VM placement #
count = "${var.vsphere_proxy_number}"
name = "${var.vsphere_vm_name}W${count.index + 1}"
name = "${var.vsphere_vm_name}-W${random_integer.priority.result}-${count.index + 1}"
resource_pool_id = "${data.vsphere_resource_pool.resource_pool.id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
folder = "${var.vsphere_vm_folder}"
Expand Down Expand Up @@ -41,7 +41,7 @@ resource "vsphere_virtual_machine" "VBR-PROXY" {

customize {
windows_options {
computer_name = "${var.vsphere_vm_name}W${count.index + 1}"
computer_name = "${var.vsphere_vm_name}-W${random_integer.priority.result}-${count.index + 1}"
join_domain = "${var.vsphere_ad_domain}"
domain_admin_user = "${var.vsphere_ad_username}"
domain_admin_password = "${var.vsphere_ad_password}"
Expand Down
1 change: 0 additions & 1 deletion project_otosukeru/proxy_windows/terraform.tfvars
Expand Up @@ -12,7 +12,6 @@ vsphere_ad_password = "password$12"
# VM specifications
vsphere_datacenter = "VC03"
vsphere_vm_folder = "TPM03-AS"
vsphere_vm_name = "VBR-PROXY-"
vsphere_vm_resource_pool ="TPM03-AS"
vsphere_vm_template = "TPM03-AS/WIN2K19-TEST"
vsphere_vm_firmware = "efi"
Expand Down
3 changes: 2 additions & 1 deletion project_otosukeru/proxy_windows/variables.tf
Expand Up @@ -33,7 +33,8 @@ variable "vsphere_datacenter" {
}

variable "vsphere_vm_name" {
description = "What is the name of the VM"
description = "What is the name of the VM - Should be no more than 7 characters long"
default = "VBR-PRX"
}

variable "vsphere_vm_template" {
Expand Down

0 comments on commit 97e615e

Please sign in to comment.