|
@@ -25,6 +25,12 @@ resource "libvirt_volume" "master" {
|
|
base_volume_id = "${module.volume.coreos_base_volume_id}"
|
|
base_volume_id = "${module.volume.coreos_base_volume_id}"
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+resource "libvirt_volume" "worker" {
|
|
|
|
+ count = "${var.worker_count}"
|
|
|
|
+ name = "${var.cluster_name}-worker-${count.index}"
|
|
|
|
+ base_volume_id = "${module.volume.coreos_base_volume_id}"
|
|
|
|
+}
|
|
|
|
+
|
|
resource "libvirt_network" "net" {
|
|
resource "libvirt_network" "net" {
|
|
name = "${var.cluster_name}"
|
|
name = "${var.cluster_name}"
|
|
|
|
|
|
@@ -91,6 +97,31 @@ resource "libvirt_domain" "master" {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+resource "libvirt_domain" "worker" {
|
|
|
|
+ count = "${var.worker_count}"
|
|
|
|
+
|
|
|
|
+ name = "${var.cluster_name}-worker-${count.index}"
|
|
|
|
+
|
|
|
|
+ memory = "${var.libvirt_worker_memory}"
|
|
|
|
+ vcpu = "${var.libvirt_worker_vcpu}"
|
|
|
|
+
|
|
|
|
+ cloudinit = "${libvirt_cloudinit_disk.commoninit.id}"
|
|
|
|
+ disk {
|
|
|
|
+ volume_id = "${element(libvirt_volume.worker.*.id, count.index)}"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console {
|
|
|
|
+ type = "pty"
|
|
|
|
+ target_port = 0
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ network_interface {
|
|
|
|
+ network_id = "${libvirt_network.net.id}"
|
|
|
|
+ hostname = "${var.cluster_name}-worker-${count.index}"
|
|
|
|
+ addresses = ["${var.libvirt_worker_ips[count.index]}"]
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
data "libvirt_network_dns_host_template" "bootstrap" {
|
|
data "libvirt_network_dns_host_template" "bootstrap" {
|
|
count = "${var.bootstrap_dns ? 1 : 0}"
|
|
count = "${var.bootstrap_dns ? 1 : 0}"
|
|
ip = "${var.libvirt_bootstrap_ip}"
|
|
ip = "${var.libvirt_bootstrap_ip}"
|