from Bitbucket to TFS #realquick #memo
I had to do a move from Bitbucket to TFS
It was done without pain… There were few steps :
git clone –bare
git push –mirror
git rm –cached
REDACTION IN PROGRESS
It was done without pain… There were few steps :
git clone –bare
git push –mirror
git rm –cached
REDACTION IN PROGRESS
Now, I had to use it for my job with vSphere :)
I wanted to create a bunch of VMs from a template, the configuration is simple, you have to “declare” :
Before to continue, I want to talk about the FOLDER… I had to use this resource for creating my VMs, otherwise it was not possible :/
resource “vsphere_folder” “folder” {
path = “XX/XX/testing-infra”
type = “vm”
datacenter_id = “${data.vsphere_datacenter.dc.id}”
}
In other terms, I don’t know how to add VMs to an existing folder, so each time I have new friend !
For the rest of the configuration, you have to use “count” with the number of your choice :
resource “vsphere_virtual_machine” “vm” {
count = 3
name = “${var.servername}-${count.index + 1}”
num_cpus = 2
memory = 2048
datastore_id = “${data.vsphere_datastore.datastore.id}”
host_system_id = “${data.vsphere_host.host.id}”
resource_pool_id = “${data.vsphere_resource_pool.pool.id}”
guest_id = “${data.vsphere_virtual_machine.template.guest_id}”
scsi_type = “${data.vsphere_virtual_machine.template.scsi_type}”
folder = “${vsphere_folder.folder.path}“
Then you can add the variable ${count.index + 1}” to increment automatically the name of your VMs for example or the hostname, IP address and so on.
You can have a look in my repo. There are two files :
Logs are important and you know it :
export TF_LOG=”TRACE”
export TF_LOG_PATH=”terraform.txt”
I almost forgot to talk about the plugin vSphere for Terraform :p
You can take it here
Then after the unzip, put it in this directory :
.terraform/plugins/linux_amd64
The folder .terraform should be in a directory with main.tf and variables.tf
./terraform init
./terraform plan
./terraform apply
Commands to run the playbook :
As you can see, I’m not an expert and you can find easily more information about this topic but I hope I will help you to start your journey :) I am only a small INN where you can have a rest and good time !
Reply