From 18c034a78fb0a3a6c7b5dd7bdd1d3d40ac7ad0bd Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 09:54:47 -0500 Subject: [PATCH 01/43] added variable keypair-name and public-key --- vars.tf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vars.tf b/vars.tf index 642a5dc..37620ac 100644 --- a/vars.tf +++ b/vars.tf @@ -10,3 +10,9 @@ variable "public-network-name" { default = "bright-external-flat-externalnet" } +variable "keypair-name" { + default = "os-gen-keypair" +} + +variable "public-key" { + default = "${file("~/.ssh/id_rsa.pub")}" \ No newline at end of file -- GitLab From d22b41eeaf7735fc08af93fa53eba8a7dcf0d7cb Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 09:55:54 -0500 Subject: [PATCH 02/43] using keys in vars file for openstack_compute_keypair_v2" --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 3282705..2f6b76d 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,6 @@ resource "openstack_compute_keypair_v2" "keypair" { - name = "my-keypair" - public_key = "${file("~/.ssh/id_rsa.pub")}" + name = "${var.os-gen-keypair}" + public_key = "${var.public-key}" } #local variable for ssh connect to ohpc -- GitLab From ec69549309a9d73b9d5d061c33c3495966b0dbc0 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 10:08:49 -0500 Subject: [PATCH 03/43] added enable-dhcp vars to have a default of true --- vars.tf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vars.tf b/vars.tf index 37620ac..5d1edf3 100644 --- a/vars.tf +++ b/vars.tf @@ -15,4 +15,10 @@ variable "keypair-name" { } variable "public-key" { - default = "${file("~/.ssh/id_rsa.pub")}" \ No newline at end of file + default = "${file("~/.ssh/id_rsa.pub")}" + } + +variable "enable-dhcp" { + description = "whether dhcp in enabled. defualt is true" + default = true + } \ No newline at end of file -- GitLab From 862fcd2e73fc14f8927add2f51160ee51a516128 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 10:09:34 -0500 Subject: [PATCH 04/43] using defualt value true in vars file for enable_dhcp --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 2f6b76d..986ff7e 100644 --- a/main.tf +++ b/main.tf @@ -24,7 +24,7 @@ resource "openstack_networking_subnet_v2" "dmzsubnet" { cidr = "192.168.100.0/24" ip_version = 4 dns_nameservers = ["8.8.8.8"] - enable_dhcp = true + enable_dhcp = "${var.enable-dhcp}" } # defines the router borderrouter using floating ip defined in datasources.tf to create the external network id @@ -52,7 +52,7 @@ resource "openstack_networking_subnet_v2" "clustersubnet" { network_id = "${openstack_networking_network_v2.clusternet.id}" cidr = "10.1.1.0/24" ip_version = 4 - enable_dhcp = true + enable_dhcp = "${var.enable-dhcp}" } -- GitLab From c5a79324ab249b875f05d9723c8ef01392199885 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 10:25:03 -0500 Subject: [PATCH 05/43] using pub and private key info from datasources --- main.tf | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/main.tf b/main.tf index 986ff7e..6219c70 100644 --- a/main.tf +++ b/main.tf @@ -1,7 +1,3 @@ -resource "openstack_compute_keypair_v2" "keypair" { - name = "${var.os-gen-keypair}" - public_key = "${var.public-key}" -} #local variable for ssh connect to ohpc locals { @@ -67,7 +63,7 @@ depends_on = ["openstack_networking_subnet_v2.dmzsubnet"] name = "ohpc" image_name = "${var.image}" flavor_name = "${var.flavor}" - key_pair = "${openstack_compute_keypair_v2.keypair.name}" + key_pair = "${data.openstack_compute_keypair_v2.keypair.name}" security_groups = ["default"] # defines the networks of the instance @@ -88,7 +84,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { connection { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" user = "centos" - private_key = "${file("~/.ssh/id_rsa")}" + private_key = "${data.openstack_compute_keypair_v2.keypair.private_key}" } inline = [ -- GitLab From 41df417f5e64869375917f8dd3ee733480d08ac4 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 10:25:14 -0500 Subject: [PATCH 06/43] Update vars.tf --- vars.tf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vars.tf b/vars.tf index 5d1edf3..c2c7385 100644 --- a/vars.tf +++ b/vars.tf @@ -13,10 +13,6 @@ variable "public-network-name" { variable "keypair-name" { default = "os-gen-keypair" } - -variable "public-key" { - default = "${file("~/.ssh/id_rsa.pub")}" - } variable "enable-dhcp" { description = "whether dhcp in enabled. defualt is true" -- GitLab From 7498e39f73569caee82b4211d0a5fffa4abc433c Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 10:26:00 -0500 Subject: [PATCH 07/43] added compute keypair --- datasources.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/datasources.tf b/datasources.tf index 574bd17..6734831 100644 --- a/datasources.tf +++ b/datasources.tf @@ -1,3 +1,10 @@ data "openstack_networking_network_v2" "public-network" { name = "${var.public-network-name}" } + +data "openstack_compute_keypair_v2" "keypair" { + name = "${var.os-gen-keypair}" + public_key = "${file("~/.ssh/id_rsa.pub")}" + private_key = "${file("~/.ssh/id_rsa")}" +} + -- GitLab From e575213761f6bc0db7bac803e199ab1f9fc6c354 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 12:03:58 -0500 Subject: [PATCH 08/43] Update datasources.tf --- datasources.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasources.tf b/datasources.tf index 6734831..798a171 100644 --- a/datasources.tf +++ b/datasources.tf @@ -2,7 +2,7 @@ data "openstack_networking_network_v2" "public-network" { name = "${var.public-network-name}" } -data "openstack_compute_keypair_v2" "keypair" { +resource "openstack_compute_keypair_v2" "keypair" { name = "${var.os-gen-keypair}" public_key = "${file("~/.ssh/id_rsa.pub")}" private_key = "${file("~/.ssh/id_rsa")}" -- GitLab From 0e6d51673258c0831aba20524a0731aa768d3bdf Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 12:04:31 -0500 Subject: [PATCH 09/43] Update datasources.tf --- datasources.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasources.tf b/datasources.tf index 798a171..3d370d0 100644 --- a/datasources.tf +++ b/datasources.tf @@ -3,7 +3,7 @@ data "openstack_networking_network_v2" "public-network" { } resource "openstack_compute_keypair_v2" "keypair" { - name = "${var.os-gen-keypair}" + name = "${var.keypair-name}" public_key = "${file("~/.ssh/id_rsa.pub")}" private_key = "${file("~/.ssh/id_rsa")}" } -- GitLab From fea08ed8ce447217d0c6c6206c55ee04103821d8 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 12:06:06 -0500 Subject: [PATCH 10/43] Update datasources.tf --- datasources.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/datasources.tf b/datasources.tf index 3d370d0..5425b75 100644 --- a/datasources.tf +++ b/datasources.tf @@ -5,6 +5,5 @@ data "openstack_networking_network_v2" "public-network" { resource "openstack_compute_keypair_v2" "keypair" { name = "${var.keypair-name}" public_key = "${file("~/.ssh/id_rsa.pub")}" - private_key = "${file("~/.ssh/id_rsa")}" } -- GitLab From f933fb1dde8e64f1e01248a12587328eb847b8ba Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 12:33:40 -0500 Subject: [PATCH 11/43] added compute keypair --- datasources.tf | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/datasources.tf b/datasources.tf index 5425b75..71e204e 100644 --- a/datasources.tf +++ b/datasources.tf @@ -2,8 +2,7 @@ data "openstack_networking_network_v2" "public-network" { name = "${var.public-network-name}" } -resource "openstack_compute_keypair_v2" "keypair" { - name = "${var.keypair-name}" - public_key = "${file("~/.ssh/id_rsa.pub")}" -} - +data "openstack_compute_keypair_v2" "keypair" { + name = "${var.keypair-name}" + public_key = "${var.ssh_public_key}" + } \ No newline at end of file -- GitLab From c765377fb6d7c15a3ee4f06d894c9fbd016884bf Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 12:33:58 -0500 Subject: [PATCH 12/43] added pub and private keys files --- vars.tf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vars.tf b/vars.tf index c2c7385..7a84cc6 100644 --- a/vars.tf +++ b/vars.tf @@ -13,6 +13,19 @@ variable "public-network-name" { variable "keypair-name" { default = "os-gen-keypair" } + +variable "ssh_public_key" { + description = "Path to file containing public key" + default = + "~/.ssh/id_rsa.pub" +} + +variable "ssh_private_key" { + description = "Path to file containing private key" + default = + "~/.ssh/id_rsa" +} + variable "enable-dhcp" { description = "whether dhcp in enabled. defualt is true" -- GitLab From 6d6f6e94d4b296e84aedc0f203a882f14b179367 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 12:34:20 -0500 Subject: [PATCH 13/43] used key info from datasources and vars --- main.tf | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/main.tf b/main.tf index 6219c70..26e397f 100644 --- a/main.tf +++ b/main.tf @@ -1,12 +1,11 @@ - #local variable for ssh connect to ohpc -locals { - connection = { - host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - user = "centos" - private_key = "${file("~/.ssh/id_rsa")}" - } -} +#locals { + # connection = { + # host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" + # user = "centos" + #private_key = "${file("~/.ssh/id_rsa")}" + # } +#} # creates dmznet resource "openstack_networking_network_v2" "dmznet" { @@ -84,7 +83,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { connection { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" user = "centos" - private_key = "${data.openstack_compute_keypair_v2.keypair.private_key}" + private_key = "${var.ssh_private_key}" } inline = [ @@ -104,7 +103,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" #host = "${openstack_networking_floatingip_v2.terraform.address}" user = "centos" - private_key = "${file("~/.ssh/id_rsa")}" + private_key = "${var.ssh_private_key}" } } @@ -113,7 +112,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" #host = "${openstack_networking_floatingip_v2.ohpc.address}" user = "centos" - private_key = "${file("~/.ssh/id_rsa")}" + private_key = "${var.ssh_private_key}" } inline = [ "sudo ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` /CRI_XCBC/site.yaml -b" -- GitLab From eb44c6b9ad34617e89fbc1a1b3a1691861029e05 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 12:39:18 -0500 Subject: [PATCH 14/43] Update main.tf --- main.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 26e397f..27dd13e 100644 --- a/main.tf +++ b/main.tf @@ -1,3 +1,8 @@ +resource "openstack_compute_keypair_v2" "keypair" { + name = "${var.keypair-name}" + public_key = "${var.ssh_public_key}" + } + #local variable for ssh connect to ohpc #locals { # connection = { @@ -62,7 +67,7 @@ depends_on = ["openstack_networking_subnet_v2.dmzsubnet"] name = "ohpc" image_name = "${var.image}" flavor_name = "${var.flavor}" - key_pair = "${data.openstack_compute_keypair_v2.keypair.name}" + key_pair = "${openstack_compute_keypair_v2.keypair.name}" security_groups = ["default"] # defines the networks of the instance -- GitLab From 56b0c7b275c6e499b64cb67c582133e7633475d9 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Wed, 10 Jul 2019 12:39:30 -0500 Subject: [PATCH 15/43] Update datasources.tf --- datasources.tf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/datasources.tf b/datasources.tf index 71e204e..9afabba 100644 --- a/datasources.tf +++ b/datasources.tf @@ -2,7 +2,3 @@ data "openstack_networking_network_v2" "public-network" { name = "${var.public-network-name}" } -data "openstack_compute_keypair_v2" "keypair" { - name = "${var.keypair-name}" - public_key = "${var.ssh_public_key}" - } \ No newline at end of file -- GitLab From 4b487db493ab18bbc6590e1404939c24e7d4f97d Mon Sep 17 00:00:00 2001 From: Ryan Jones Date: Wed, 10 Jul 2019 13:42:40 -0500 Subject: [PATCH 16/43] took out key data --- datasources.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/datasources.tf b/datasources.tf index 9afabba..574bd17 100644 --- a/datasources.tf +++ b/datasources.tf @@ -1,4 +1,3 @@ data "openstack_networking_network_v2" "public-network" { name = "${var.public-network-name}" } - -- GitLab From ba5601a8cee534ebadcbd1b40f1f449fe07ae85d Mon Sep 17 00:00:00 2001 From: Ryan Jones Date: Wed, 10 Jul 2019 13:43:28 -0500 Subject: [PATCH 17/43] updated pub and private key info --- main.tf | 24 ++++++++++++------------ vars.tf | 8 +++----- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/main.tf b/main.tf index 27dd13e..4032d1f 100644 --- a/main.tf +++ b/main.tf @@ -1,16 +1,16 @@ resource "openstack_compute_keypair_v2" "keypair" { name = "${var.keypair-name}" - public_key = "${var.ssh_public_key}" - } + public_key = "${file(var.ssh_public_key)}" +} #local variable for ssh connect to ohpc -#locals { - # connection = { - # host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - # user = "centos" - #private_key = "${file("~/.ssh/id_rsa")}" - # } -#} +locals { + connection = { + host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" + user = "centos" + private_key = "${file(var.ssh_private_key)}" + } +} # creates dmznet resource "openstack_networking_network_v2" "dmznet" { @@ -88,7 +88,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { connection { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" user = "centos" - private_key = "${var.ssh_private_key}" + private_key = "${file(var.ssh_private_key)}" } inline = [ @@ -108,7 +108,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" #host = "${openstack_networking_floatingip_v2.terraform.address}" user = "centos" - private_key = "${var.ssh_private_key}" + private_key = "${file(var.ssh_private_key)}" } } @@ -117,7 +117,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" #host = "${openstack_networking_floatingip_v2.ohpc.address}" user = "centos" - private_key = "${var.ssh_private_key}" + private_key = "${file(var.ssh_private_key)}" } inline = [ "sudo ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` /CRI_XCBC/site.yaml -b" diff --git a/vars.tf b/vars.tf index 7a84cc6..d29e1f6 100644 --- a/vars.tf +++ b/vars.tf @@ -16,18 +16,16 @@ variable "keypair-name" { variable "ssh_public_key" { description = "Path to file containing public key" - default = - "~/.ssh/id_rsa.pub" + default = "~/.ssh/id_rsa.pub" } variable "ssh_private_key" { description = "Path to file containing private key" - default = - "~/.ssh/id_rsa" + default = "~/.ssh/id_rsa" } variable "enable-dhcp" { description = "whether dhcp in enabled. defualt is true" default = true - } \ No newline at end of file + } -- GitLab From 95cea6cd000a4bb0e820b27642552a9e2d7b4c3c Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 09:48:00 -0500 Subject: [PATCH 18/43] removed unused second host line in connection --- main.tf | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/main.tf b/main.tf index 4032d1f..3c02951 100644 --- a/main.tf +++ b/main.tf @@ -4,13 +4,13 @@ resource "openstack_compute_keypair_v2" "keypair" { } #local variable for ssh connect to ohpc -locals { - connection = { - host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - user = "centos" - private_key = "${file(var.ssh_private_key)}" - } -} +#locals { +# connection = { +# host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" +# user = "centos" +# private_key = "${file(var.ssh_private_key)}" +# } +#} # creates dmznet resource "openstack_networking_network_v2" "dmznet" { @@ -106,7 +106,6 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { destination = "/CRI_XCBC/" connection { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - #host = "${openstack_networking_floatingip_v2.terraform.address}" user = "centos" private_key = "${file(var.ssh_private_key)}" } @@ -115,7 +114,6 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { provisioner "remote-exec" { connection { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - #host = "${openstack_networking_floatingip_v2.ohpc.address}" user = "centos" private_key = "${file(var.ssh_private_key)}" } -- GitLab From 0e29a081ac807263bd71a2a422eebf698bd42c73 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 09:56:20 -0500 Subject: [PATCH 19/43] added comments to remote exec and file blocks --- main.tf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 3c02951..e3e2583 100644 --- a/main.tf +++ b/main.tf @@ -84,6 +84,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { floating_ip = "${openstack_networking_floatingip_v2.ip_pool.address}" instance_id = "${openstack_compute_instance_v2.ohpc.id}" + #defines ssh connection to ohpc and runs installs provisioner "remote-exec" { connection { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" @@ -101,6 +102,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { ] } + # moves CRI_XCBC file into repo to use in next step provisioner "file" { source = "CRI_XCBC/" destination = "/CRI_XCBC/" @@ -110,7 +112,8 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { private_key = "${file(var.ssh_private_key)}" } } - + + # uses ssh connection to run ansible playbook provisioner "remote-exec" { connection { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" -- GitLab From 617a4b83b83bb6ae12c5d03a3256d888fb508f9a Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 10:59:41 -0500 Subject: [PATCH 20/43] defined ssh connections before provisioners are run so they will all use that connection info --- main.tf | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/main.tf b/main.tf index e3e2583..699bd4b 100644 --- a/main.tf +++ b/main.tf @@ -83,15 +83,16 @@ depends_on = ["openstack_networking_subnet_v2.dmzsubnet"] resource "openstack_compute_floatingip_associate_v2" "ohpc" { floating_ip = "${openstack_networking_floatingip_v2.ip_pool.address}" instance_id = "${openstack_compute_instance_v2.ohpc.id}" - - #defines ssh connection to ohpc and runs installs - provisioner "remote-exec" { + + # defines ssh connection connection { host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" user = "centos" private_key = "${file(var.ssh_private_key)}" } - + + # installs programs + provisioner "remote-exec" { inline = [ "sudo mkdir -p /CRI_XCBC && sudo chown centos: /CRI_XCBC", "sudo yum install -y epel-release", @@ -102,24 +103,14 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { ] } - # moves CRI_XCBC file into repo to use in next step + # moves CRI_XCBC file into directory made above provisioner "file" { source = "CRI_XCBC/" destination = "/CRI_XCBC/" - connection { - host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - user = "centos" - private_key = "${file(var.ssh_private_key)}" - } } - # uses ssh connection to run ansible playbook + # runs ansible playbook provisioner "remote-exec" { - connection { - host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - user = "centos" - private_key = "${file(var.ssh_private_key)}" - } inline = [ "sudo ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` /CRI_XCBC/site.yaml -b" ] -- GitLab From 9354adaf8da8f303d590abfdbae2c1394cbd5e18 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 11:25:59 -0500 Subject: [PATCH 21/43] uses ohpc_user variable for host --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 699bd4b..0aed97d 100644 --- a/main.tf +++ b/main.tf @@ -86,8 +86,8 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { # defines ssh connection connection { - host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - user = "centos" + host = "${format(var.host_id)}" + user = "${var.ohpc_user}" private_key = "${file(var.ssh_private_key)}" } -- GitLab From ee1f71e1839e5ca8a8810717207dab0479ca6988 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 11:26:37 -0500 Subject: [PATCH 22/43] created variables ohpc_user and host_id --- vars.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vars.tf b/vars.tf index d29e1f6..bba7abc 100644 --- a/vars.tf +++ b/vars.tf @@ -2,6 +2,10 @@ variable "image" { default = "CentOS-7-x86_64-GenericCloud-1905" } +variable "ohpc_user" { + default = "centos" +} + variable "flavor" { default = "m1.medium" } @@ -24,6 +28,9 @@ variable "ssh_private_key" { default = "~/.ssh/id_rsa" } +variable "host_id" { + description = "format of host id. Adds the last three digits of floating ip to create the last part of the host ip" + default = ""164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3)" variable "enable-dhcp" { description = "whether dhcp in enabled. defualt is true" -- GitLab From 9160771c4d60d38800c0c66acaa870a0eba80280 Mon Sep 17 00:00:00 2001 From: Ryan Jones Date: Thu, 11 Jul 2019 11:29:49 -0500 Subject: [PATCH 23/43] added missing curly bracket --- vars.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vars.tf b/vars.tf index bba7abc..f90ac78 100644 --- a/vars.tf +++ b/vars.tf @@ -31,8 +31,9 @@ variable "ssh_private_key" { variable "host_id" { description = "format of host id. Adds the last three digits of floating ip to create the last part of the host ip" default = ""164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3)" +} variable "enable-dhcp" { description = "whether dhcp in enabled. defualt is true" default = true - } +} -- GitLab From eb652a5ea51017e73415fb885abfb6292799ffa0 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 11:46:54 -0500 Subject: [PATCH 24/43] update host vars --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 0aed97d..8059cfa 100644 --- a/main.tf +++ b/main.tf @@ -86,7 +86,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { # defines ssh connection connection { - host = "${format(var.host_id)}" + host = "${format("var.host_prefix",var.host_id_formatting)}" user = "${var.ohpc_user}" private_key = "${file(var.ssh_private_key)}" } -- GitLab From 8966b9061f51c5e98885597c79fdfd4ac34e86d8 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 11:47:02 -0500 Subject: [PATCH 25/43] update host vars --- vars.tf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vars.tf b/vars.tf index f90ac78..42d1eca 100644 --- a/vars.tf +++ b/vars.tf @@ -28,10 +28,14 @@ variable "ssh_private_key" { default = "~/.ssh/id_rsa" } -variable "host_id" { +variable "host_prefix" { description = "format of host id. Adds the last three digits of floating ip to create the last part of the host ip" - default = ""164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3)" + default = "164.111.161.%s" } + +variable "host_id_formatting" { + description = + default = "element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3)" variable "enable-dhcp" { description = "whether dhcp in enabled. defualt is true" -- GitLab From b011b8382be999308942000b74a46087ea93f77a Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 11:52:23 -0500 Subject: [PATCH 26/43] Update host using host prefix var --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 8059cfa..0aace0d 100644 --- a/main.tf +++ b/main.tf @@ -86,7 +86,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { # defines ssh connection connection { - host = "${format("var.host_prefix",var.host_id_formatting)}" + host = "${format("var.host_prefix", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" user = "${var.ohpc_user}" private_key = "${file(var.ssh_private_key)}" } -- GitLab From 252712bc5bd919fe2befda31711a27554bf58735 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 11:52:41 -0500 Subject: [PATCH 27/43] added host prefix var --- vars.tf | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vars.tf b/vars.tf index 42d1eca..0e8d836 100644 --- a/vars.tf +++ b/vars.tf @@ -29,14 +29,10 @@ variable "ssh_private_key" { } variable "host_prefix" { - description = "format of host id. Adds the last three digits of floating ip to create the last part of the host ip" + description = "prefix of host id." default = "164.111.161.%s" } -variable "host_id_formatting" { - description = - default = "element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3)" - variable "enable-dhcp" { description = "whether dhcp in enabled. defualt is true" default = true -- GitLab From 57a94316a0cd77009f07d74d37480f683984df84 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:24:39 -0500 Subject: [PATCH 28/43] updated clusternet info to internal net and uses vars external net --- main.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.tf b/main.tf index 0aace0d..de6c165 100644 --- a/main.tf +++ b/main.tf @@ -41,15 +41,15 @@ resource "openstack_networking_router_interface_v2" "borderrouter" { # creates clusternet -resource "openstack_networking_network_v2" "clusternet" { - name = "clusternet" +resource "openstack_networking_network_v2" "internal_net" { + name = "${var.internal-net}" admin_state_up = "true" } # creates clustersubnet # cidr is the subnet range (that subnet range and dns nameservers from the network create file in feat-openstack) -resource "openstack_networking_subnet_v2" "clustersubnet" { - name = "clustersubnet" - network_id = "${openstack_networking_network_v2.clusternet.id}" +resource "openstack_networking_subnet_v2" "internal_subnet" { + name = "${var.internal-subnet}" + network_id = "${openstack_networking_network_v2.internal-subnet.id}" cidr = "10.1.1.0/24" ip_version = 4 enable_dhcp = "${var.enable-dhcp}" -- GitLab From bda7bab322505121448767dd7146580c36cbd628 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:27:43 -0500 Subject: [PATCH 29/43] changed to use vars borderrouter --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index de6c165..f467064 100644 --- a/main.tf +++ b/main.tf @@ -28,14 +28,14 @@ resource "openstack_networking_subnet_v2" "dmzsubnet" { } # defines the router borderrouter using floating ip defined in datasources.tf to create the external network id -resource "openstack_networking_router_v2" "borderrouter" { - name = "borderrouter" +resource "openstack_networking_router_v2" "router" { + name = "${var.router}" admin_state_up = "true" external_network_id = "${data.openstack_networking_network_v2.public-network.id}" } -resource "openstack_networking_router_interface_v2" "borderrouter" { - router_id = "${openstack_networking_router_v2.borderrouter.id}" +resource "openstack_networking_router_interface_v2" "router" { + router_id = "${openstack_networking_router_v2.router.id}" subnet_id = "${openstack_networking_subnet_v2.dmzsubnet.id}" } -- GitLab From debfa07a2710d209bce2deb47daf89980cb0548d Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:36:40 -0500 Subject: [PATCH 30/43] changed cluster and dmz to internal and external as defined in vars file --- main.tf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/main.tf b/main.tf index f467064..e539d20 100644 --- a/main.tf +++ b/main.tf @@ -13,14 +13,14 @@ resource "openstack_compute_keypair_v2" "keypair" { #} # creates dmznet -resource "openstack_networking_network_v2" "dmznet" { - name = "dmznet" +resource "openstack_networking_network_v2" "external_net" { + name = "${var.external-net}" admin_state_up = "true" } -resource "openstack_networking_subnet_v2" "dmzsubnet" { - name = "dmzsubnet" - network_id = "${openstack_networking_network_v2.dmznet.id}" +resource "openstack_networking_subnet_v2" "external_subnet" { + name = "${var.external-subnet}" + network_id = "${openstack_networking_network_v2.external_net.id}" cidr = "192.168.100.0/24" ip_version = 4 dns_nameservers = ["8.8.8.8"] @@ -36,7 +36,7 @@ resource "openstack_networking_router_v2" "router" { resource "openstack_networking_router_interface_v2" "router" { router_id = "${openstack_networking_router_v2.router.id}" - subnet_id = "${openstack_networking_subnet_v2.dmzsubnet.id}" + subnet_id = "${openstack_networking_subnet_v2.external_subnet.id}" } @@ -63,7 +63,7 @@ resource "openstack_networking_floatingip_v2" "ip_pool" { # creates details for the OHPC instance using variables defined in vars.tf resource "openstack_compute_instance_v2" "ohpc" { -depends_on = ["openstack_networking_subnet_v2.dmzsubnet"] +depends_on = ["openstack_networking_subnet_v2.external_net"] name = "ohpc" image_name = "${var.image}" flavor_name = "${var.flavor}" @@ -72,10 +72,10 @@ depends_on = ["openstack_networking_subnet_v2.dmzsubnet"] # defines the networks of the instance network { - name = "dmznet" + name = "${var.external-net}" } network { - name = "clusternet" + name = "${var.internal-net}" } } -- GitLab From 9579e079fc8787d8aeb0a85fcc60dccc31e5dab5 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:37:19 -0500 Subject: [PATCH 31/43] added vars for clusternet/sub, dmznet/sub, and borderrouter --- vars.tf | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vars.tf b/vars.tf index 0e8d836..8e5c3a0 100644 --- a/vars.tf +++ b/vars.tf @@ -1,3 +1,21 @@ +variable "internal-net" { + default = "clusternet" +} + +variable "internal-subnet" { + default = "clustersubnet" +} + +variable "external-net" { + default = "dmznet" +} + +variable "external-subnet" { + default = "dmzsubnet" +} +variable "router" { + default = "borderrouter" + variable "image" { default = "CentOS-7-x86_64-GenericCloud-1905" } -- GitLab From df53e2e93096106e20e4b578f82f89d53a7f69b5 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:39:28 -0500 Subject: [PATCH 32/43] added var for admin state as true --- vars.tf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vars.tf b/vars.tf index 8e5c3a0..0c6cdd4 100644 --- a/vars.tf +++ b/vars.tf @@ -55,3 +55,9 @@ variable "enable-dhcp" { description = "whether dhcp in enabled. defualt is true" default = true } + +variable "admin_state_up" { + description = "whether admin state in enabled. defualt is true" + default = true +} + -- GitLab From e9867ed5c604730a8b2d30e0f97d9ad84d24ceda Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:39:47 -0500 Subject: [PATCH 33/43] update to use admin state up variable --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index e539d20..41d46fc 100644 --- a/main.tf +++ b/main.tf @@ -15,7 +15,7 @@ resource "openstack_compute_keypair_v2" "keypair" { # creates dmznet resource "openstack_networking_network_v2" "external_net" { name = "${var.external-net}" - admin_state_up = "true" + admin_state_up = "${var.admin_state_up}" } resource "openstack_networking_subnet_v2" "external_subnet" { @@ -30,7 +30,7 @@ resource "openstack_networking_subnet_v2" "external_subnet" { # defines the router borderrouter using floating ip defined in datasources.tf to create the external network id resource "openstack_networking_router_v2" "router" { name = "${var.router}" - admin_state_up = "true" + admin_state_up = "${var.admin_state_up}" external_network_id = "${data.openstack_networking_network_v2.public-network.id}" } @@ -43,7 +43,7 @@ resource "openstack_networking_router_interface_v2" "router" { # creates clusternet resource "openstack_networking_network_v2" "internal_net" { name = "${var.internal-net}" - admin_state_up = "true" + admin_state_up = "${var.admin_state_up}" } # creates clustersubnet # cidr is the subnet range (that subnet range and dns nameservers from the network create file in feat-openstack) -- GitLab From 35090fee448f77d1b81c03f65662626b15fee9b9 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:44:38 -0500 Subject: [PATCH 34/43] changed all vars to match changed in vars file --- main.tf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.tf b/main.tf index 41d46fc..37222bb 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,6 @@ resource "openstack_compute_keypair_v2" "keypair" { name = "${var.keypair-name}" - public_key = "${file(var.ssh_public_key)}" + public_key = "${file(var.ssh-public-key)}" } #local variable for ssh connect to ohpc @@ -8,14 +8,14 @@ resource "openstack_compute_keypair_v2" "keypair" { # connection = { # host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" # user = "centos" -# private_key = "${file(var.ssh_private_key)}" +# private_key = "${file(var.ssh-private-key)}" # } #} # creates dmznet resource "openstack_networking_network_v2" "external_net" { name = "${var.external-net}" - admin_state_up = "${var.admin_state_up}" + admin_state_up = "${var.admin-state-up}" } resource "openstack_networking_subnet_v2" "external_subnet" { @@ -30,7 +30,7 @@ resource "openstack_networking_subnet_v2" "external_subnet" { # defines the router borderrouter using floating ip defined in datasources.tf to create the external network id resource "openstack_networking_router_v2" "router" { name = "${var.router}" - admin_state_up = "${var.admin_state_up}" + admin_state_up = "${var.admin-state-up}" external_network_id = "${data.openstack_networking_network_v2.public-network.id}" } @@ -43,7 +43,7 @@ resource "openstack_networking_router_interface_v2" "router" { # creates clusternet resource "openstack_networking_network_v2" "internal_net" { name = "${var.internal-net}" - admin_state_up = "${var.admin_state_up}" + admin_state_up = "${var.admin-state-up}" } # creates clustersubnet # cidr is the subnet range (that subnet range and dns nameservers from the network create file in feat-openstack) @@ -86,9 +86,9 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { # defines ssh connection connection { - host = "${format("var.host_prefix", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" - user = "${var.ohpc_user}" - private_key = "${file(var.ssh_private_key)}" + host = "${format("var.host-prefix", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" + user = "${var.ohpc-user}" + private_key = "${file(var.ssh-private-key)}" } # installs programs -- GitLab From 6c5194a318ecf4df947874f82748b14d809b2508 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:45:48 -0500 Subject: [PATCH 35/43] updated to use "-" instead of "_" for multi word variables --- vars.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vars.tf b/vars.tf index 0c6cdd4..409fe40 100644 --- a/vars.tf +++ b/vars.tf @@ -20,7 +20,7 @@ variable "image" { default = "CentOS-7-x86_64-GenericCloud-1905" } -variable "ohpc_user" { +variable "ohpc-user" { default = "centos" } @@ -36,17 +36,17 @@ variable "keypair-name" { default = "os-gen-keypair" } -variable "ssh_public_key" { +variable "ssh-public-key" { description = "Path to file containing public key" default = "~/.ssh/id_rsa.pub" } -variable "ssh_private_key" { +variable "ssh-private-key" { description = "Path to file containing private key" default = "~/.ssh/id_rsa" } -variable "host_prefix" { +variable "host-prefix" { description = "prefix of host id." default = "164.111.161.%s" } @@ -56,7 +56,7 @@ variable "enable-dhcp" { default = true } -variable "admin_state_up" { +variable "admin-state-up" { description = "whether admin state in enabled. defualt is true" default = true } -- GitLab From 3e920f469501efdb7eb48866ad9a2b622d9d6388 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:50:36 -0500 Subject: [PATCH 36/43] added missing curly bracket --- vars.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vars.tf b/vars.tf index 409fe40..c295893 100644 --- a/vars.tf +++ b/vars.tf @@ -13,8 +13,10 @@ variable "external-net" { variable "external-subnet" { default = "dmzsubnet" } + variable "router" { default = "borderrouter" +} variable "image" { default = "CentOS-7-x86_64-GenericCloud-1905" -- GitLab From d288c0e3b92e13a042b964ae3d881f4e2ea8243d Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:54:47 -0500 Subject: [PATCH 37/43] fixed overlooked net and subnet changes --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 37222bb..99c457b 100644 --- a/main.tf +++ b/main.tf @@ -49,7 +49,7 @@ resource "openstack_networking_network_v2" "internal_net" { # cidr is the subnet range (that subnet range and dns nameservers from the network create file in feat-openstack) resource "openstack_networking_subnet_v2" "internal_subnet" { name = "${var.internal-subnet}" - network_id = "${openstack_networking_network_v2.internal-subnet.id}" + network_id = "${openstack_networking_network_v2.internal_net.id}" cidr = "10.1.1.0/24" ip_version = 4 enable_dhcp = "${var.enable-dhcp}" @@ -63,7 +63,7 @@ resource "openstack_networking_floatingip_v2" "ip_pool" { # creates details for the OHPC instance using variables defined in vars.tf resource "openstack_compute_instance_v2" "ohpc" { -depends_on = ["openstack_networking_subnet_v2.external_net"] +depends_on = ["openstack_networking_subnet_v2.external_subnet"] name = "ohpc" image_name = "${var.image}" flavor_name = "${var.flavor}" -- GitLab From 3ff52c1ec04acd765a4a16a78b50c8ad49e34fb4 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 12:56:32 -0500 Subject: [PATCH 38/43] updated with internal and external net --- output.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/output.tf b/output.tf index cac1060..fcec642 100644 --- a/output.tf +++ b/output.tf @@ -2,10 +2,10 @@ output "address" { value = "${openstack_networking_floatingip_v2.ip_pool.address}" } -output "dmznet_network_id" { - value = "${openstack_networking_network_v2.dmznet.id}" +output "external_network_id" { + value = "${openstack_networking_network_v2.external_net.id}" } -output "clusternet_network_id" { - value = "${openstack_networking_network_v2.clusternet.id}" +output "internal_network_id" { + value = "${openstack_networking_network_v2.internal_net.id}" } -- GitLab From 08826abc6b232f928535cc5820f49579bec79c10 Mon Sep 17 00:00:00 2001 From: Ryan Jones Date: Thu, 11 Jul 2019 13:24:29 -0500 Subject: [PATCH 39/43] updated host info to work with vars host prefix --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 99c457b..d31ad2d 100644 --- a/main.tf +++ b/main.tf @@ -86,7 +86,7 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { # defines ssh connection connection { - host = "${format("var.host-prefix", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" + host = "${format("${var.host-prefix}", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" user = "${var.ohpc-user}" private_key = "${file(var.ssh-private-key)}" } -- GitLab From 51f861bbf3602ceb1efce7074fd0cdc7d19c7af4 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 13:27:18 -0500 Subject: [PATCH 40/43] updated to use ohpc instance name variable --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index d31ad2d..056fe7c 100644 --- a/main.tf +++ b/main.tf @@ -64,7 +64,7 @@ resource "openstack_networking_floatingip_v2" "ip_pool" { # creates details for the OHPC instance using variables defined in vars.tf resource "openstack_compute_instance_v2" "ohpc" { depends_on = ["openstack_networking_subnet_v2.external_subnet"] - name = "ohpc" + name = "${var.ohpc-instance-name}" image_name = "${var.image}" flavor_name = "${var.flavor}" key_pair = "${openstack_compute_keypair_v2.keypair.name}" -- GitLab From 965c71c7f8b5e9227738be10394f76810f8d59d3 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 13:27:25 -0500 Subject: [PATCH 41/43] added ohpc instance name variable --- vars.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vars.tf b/vars.tf index c295893..bff86e1 100644 --- a/vars.tf +++ b/vars.tf @@ -1,3 +1,7 @@ +variable "ohpc-instance-name" { + default = "ohpc" +} + variable "internal-net" { default = "clusternet" } -- GitLab From c34a0530515c4565f7f2b5e5686326d8aeae8f92 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 13:31:11 -0500 Subject: [PATCH 42/43] put variables in alphabetical order --- vars.tf | 69 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/vars.tf b/vars.tf index bff86e1..c30b008 100644 --- a/vars.tf +++ b/vars.tf @@ -1,13 +1,11 @@ -variable "ohpc-instance-name" { - default = "ohpc" -} - -variable "internal-net" { - default = "clusternet" +variable "admin-state-up" { + description = "whether admin state in enabled. defualt is true" + default = true } -variable "internal-subnet" { - default = "clustersubnet" +variable "enable-dhcp" { + description = "whether dhcp in enabled. defualt is true" + default = true } variable "external-net" { @@ -18,52 +16,53 @@ variable "external-subnet" { default = "dmzsubnet" } -variable "router" { - default = "borderrouter" +variable "flavor" { + default = "m1.medium" } -variable "image" { - default = "CentOS-7-x86_64-GenericCloud-1905" +variable "host-prefix" { + description = "prefix of host id." + default = "164.111.161.%s" } -variable "ohpc-user" { - default = "centos" +variable "internal-net" { + default = "clusternet" } - -variable "flavor" { - default = "m1.medium" + +variable "internal-subnet" { + default = "clustersubnet" } -variable "public-network-name" { - default = "bright-external-flat-externalnet" +variable "image" { + default = "CentOS-7-x86_64-GenericCloud-1905" } variable "keypair-name" { default = "os-gen-keypair" } - -variable "ssh-public-key" { - description = "Path to file containing public key" - default = "~/.ssh/id_rsa.pub" + +variable "ohpc-instance-name" { + default = "ohpc" } -variable "ssh-private-key" { - description = "Path to file containing private key" - default = "~/.ssh/id_rsa" +variable "ohpc-user" { + default = "centos" } -variable "host-prefix" { - description = "prefix of host id." - default = "164.111.161.%s" +variable "public-network-name" { + default = "bright-external-flat-externalnet" } -variable "enable-dhcp" { - description = "whether dhcp in enabled. defualt is true" - default = true +variable "router" { + default = "borderrouter" } -variable "admin-state-up" { - description = "whether admin state in enabled. defualt is true" - default = true +variable "ssh-private-key" { + description = "Path to file containing private key" + default = "~/.ssh/id_rsa" } +variable "ssh-public-key" { + description = "Path to file containing public key" + default = "~/.ssh/id_rsa.pub" +} \ No newline at end of file -- GitLab From 2347b8ffdf581697f59b15d5eb83aecd0cf8a4c5 Mon Sep 17 00:00:00 2001 From: Ryan Randles Jones Date: Thu, 11 Jul 2019 13:32:35 -0500 Subject: [PATCH 43/43] removed unnecessary locals block --- main.tf | 9 --------- 1 file changed, 9 deletions(-) diff --git a/main.tf b/main.tf index 056fe7c..351eff5 100644 --- a/main.tf +++ b/main.tf @@ -3,15 +3,6 @@ resource "openstack_compute_keypair_v2" "keypair" { public_key = "${file(var.ssh-public-key)}" } -#local variable for ssh connect to ohpc -#locals { -# connection = { -# host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}" -# user = "centos" -# private_key = "${file(var.ssh-private-key)}" -# } -#} - # creates dmznet resource "openstack_networking_network_v2" "external_net" { name = "${var.external-net}" -- GitLab