Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 31 additions & 22 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,47 @@ provider "libvirt" {
uri = "qemu:///system"
}


#you can only uncomment either "distributed_topology or basic_topology module" for deployment and gives specefied variable values


#importing all modues from module directory

#uncomment for distributed techonology
#module "distributed_topology" {

#For Distributed all node images path required.

#source = "modules/distributed_topology/"
#proxy_img_path = "paste_proxy_image_path"
#mng_img_path = "paste_management_image_path"
#boot_img_path = "paste_boot_image_path"
#worker_img_path = "paste_worker_image_path"
#master_img_path = "paste_master_image_path"
module "distributed_topology" {


#For Distributed all node images path required.


source = "modules/distributed_topology/"
proxy_img_path = "paste_proxy_image_path"
mng_img_path = "paste_management_image_path"
boot_img_path = "paste_boot_image_path"
worker_img_path = "paste_worker_image_path"
master_img_path = "paste_master_image_path"


ssh_private_key_path = "paste_path_of_id_rsa"
default_worker = "1"
extra_worker = "0"
}

#ssh_private_key_path = "paste_path_of_id_rsa"
#default_worker = "1"
#extra_worker = "0"
#}

#uncomment for basic topology
#module "basic_topology" {

#For Basic only master_img_path and worker_img_path is required.

#source = "modules/basic_topology/"
#worker_img_path ="paste_worker_image_path"
#master_img_path ="paste_master_image_path"

#ssh_private_key_path = "paste_path_of_id_rsa"
#default_worker = "1"
#extra_worker = "0"
#For Basic only master_img_path and worker_img_path is required.


#source = "modules/basic_topology/"
#worker_img_path ="paste_worker_image_path"
#master_img_path ="paste_master_image_path"


#ssh_private_key_path = "paste_path_of_id_rsa"
#default_worker = "1"
#extra_worker = "0"
#}

4 changes: 0 additions & 4 deletions modules/basic_topology/worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@ resource "libvirt_cloudinit" "worker" {
count = "${var.default_worker}"
user_data = "${file("node_config/worker_config")}"
local_hostname = "worker${count.index}"


}

resource "libvirt_volume" "volume" {
name = "volume-${count.index}"
base_volume_id = "${libvirt_volume.ICP.id}"
count = "${var.default_worker}"


}

# Create the resource VM for worker
Expand Down
1 change: 0 additions & 1 deletion modules/distributed_topology/boot.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,4 @@ resource "libvirt_domain" "ICP_boot" {
depends_on = [
"libvirt_domain.ICP_proxy",
]

}
6 changes: 0 additions & 6 deletions modules/distributed_topology/extra_worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ resource "libvirt_cloudinit" "exworker" {
count = "${var.extra_worker}"
user_data = "${file("node_config/extraworker_config")}"
local_hostname = "exworker${count.index}"


}

resource "libvirt_volume" "exvolume" {
name = "exvolume-${count.index}"
base_volume_id = "${libvirt_volume.ICP.id}"
count = "${var.extra_worker}"


}

# Create the resource for extra worker machine
Expand All @@ -23,7 +19,6 @@ resource "libvirt_domain" "ExICPworker" {
vcpu = 2
count = "${var.extra_worker}"


cloudinit = "${element(libvirt_cloudinit.exworker.*.id,count.index)}"

depends_on = [
Expand Down Expand Up @@ -110,4 +105,3 @@ resource "null_resource" "ExICPworker" {
private_key = "${file("${var.ssh_private_key_path}")}"
}
}

2 changes: 0 additions & 2 deletions modules/distributed_topology/management.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,4 @@ resource "libvirt_domain" "ICP_mng" {
port = "22"
private_key = "${file("${var.ssh_private_key_path}")}"
}

}

3 changes: 1 addition & 2 deletions modules/distributed_topology/worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "libvirt_cloudinit" "worker" {
pool = "default" #CHANGE_ME if you use anohter storage pool
count = "${var.default_worker}"
user_data = "${file("node_config/worker_config")}"
local_hostname = "worker${count.index}"
local_hostname = "worker${count.index}"
}

resource "libvirt_volume" "volume" {
Expand Down Expand Up @@ -89,5 +89,4 @@ resource "libvirt_domain" "ICP_worker" {
depends_on = [
"libvirt_domain.ICP_mng",
]

}