Adds terraform part for glusterfs nodes.
This commit is contained in:
parent
26f93feb2d
commit
364a7d8862
2 changed files with 51 additions and 0 deletions
|
@ -130,6 +130,36 @@ resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "openstack_blockstorage_volume_v2" "glusterfs_volume" {
|
||||||
|
name = "${var.cluster_name}-gfs-nephe-vol-${count.index+1}"
|
||||||
|
count = "${var.number_of_gfs_nodes_no_floating_ip}"
|
||||||
|
description = "Non-ephemeral volume for GlusterFS"
|
||||||
|
size = "${var.gfs_volume_size_in_gb}"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "openstack_compute_instance_v2" "glusterfs_node_no_floating_ip" {
|
||||||
|
name = "${var.cluster_name}-gfs-node-nf-${count.index+1}"
|
||||||
|
count = "${var.number_of_gfs_nodes_no_floating_ip}"
|
||||||
|
image_name = "${var.image_gfs}"
|
||||||
|
flavor_id = "${var.flavor_gfs_node}"
|
||||||
|
key_pair = "${openstack_compute_keypair_v2.k8s.name}"
|
||||||
|
network {
|
||||||
|
name = "${var.network_name}"
|
||||||
|
}
|
||||||
|
security_groups = ["${openstack_compute_secgroup_v2.k8s.name}" ]
|
||||||
|
metadata = {
|
||||||
|
ssh_user = "${var.ssh_user_gfs}"
|
||||||
|
kubespray_groups = "gfs-cluster"
|
||||||
|
}
|
||||||
|
volume {
|
||||||
|
volume_id = "${element(openstack_blockstorage_volume_v2.glusterfs_volume.*.id, count.index)}"
|
||||||
|
device = "/dev/vdb"
|
||||||
|
}
|
||||||
|
provisioner "local-exec" {
|
||||||
|
command = "sed s/USER/${var.ssh_user}/ contrib/terraform/openstack/ansible_bastion_template.txt | sed s/BASTION_ADDRESS/${element(openstack_networking_floatingip_v2.k8s_master.*.address, 0)}/ > contrib/terraform/openstack/group_vars/gfs-cluster.yml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,14 @@ variable "number_of_k8s_nodes_no_floating_ip" {
|
||||||
default = 1
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "number_of_gfs_nodes_no_floating_ip" {
|
||||||
|
default = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "gfs_volume_size_in_gb" {
|
||||||
|
default = 75
|
||||||
|
}
|
||||||
|
|
||||||
variable "public_key_path" {
|
variable "public_key_path" {
|
||||||
description = "The path of the ssh pub key"
|
description = "The path of the ssh pub key"
|
||||||
default = "~/.ssh/id_rsa.pub"
|
default = "~/.ssh/id_rsa.pub"
|
||||||
|
@ -28,11 +36,21 @@ variable "image" {
|
||||||
default = "ubuntu-14.04"
|
default = "ubuntu-14.04"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "image_gfs" {
|
||||||
|
description = "Glance image to use for GlusterFS"
|
||||||
|
default = "ubuntu-16.04"
|
||||||
|
}
|
||||||
|
|
||||||
variable "ssh_user" {
|
variable "ssh_user" {
|
||||||
description = "used to fill out tags for ansible inventory"
|
description = "used to fill out tags for ansible inventory"
|
||||||
default = "ubuntu"
|
default = "ubuntu"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "ssh_user_gfs" {
|
||||||
|
description = "used to fill out tags for ansible inventory"
|
||||||
|
default = "ubuntu"
|
||||||
|
}
|
||||||
|
|
||||||
variable "flavor_k8s_master" {
|
variable "flavor_k8s_master" {
|
||||||
default = 3
|
default = 3
|
||||||
}
|
}
|
||||||
|
@ -41,6 +59,9 @@ variable "flavor_k8s_node" {
|
||||||
default = 3
|
default = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "flavor_gfs_node" {
|
||||||
|
default = 3
|
||||||
|
}
|
||||||
|
|
||||||
variable "network_name" {
|
variable "network_name" {
|
||||||
description = "name of the internal network to use"
|
description = "name of the internal network to use"
|
||||||
|
|
Loading…
Reference in a new issue