Skip to content
Snippets Groups Projects

wip: test-keypair without file

Closed Krish Moodbidri requested to merge feat-test-keypair into feat-deploy-xdmod-supremm
1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
+ 24
42
@@ -14,35 +14,6 @@ provider "openstack" {
@@ -14,35 +14,6 @@ provider "openstack" {
}
}
}
}
# runs the external-network module
module "dmz-network" {
source = "./external-network"
# Default name var is in the module main file
admin_state_up = var.admin_state_up
enable_dhcp = var.enable_dhcp
public_network_name = var.public_network_name
}
# calls the outputs defined in the external-network module
output "external_network_id" {
value = module.dmz-network.external_network_id
}
output "router_id" {
value = module.dmz-network.router_id
}
# runs the internal-network module
module "cluster-network" {
source = "./internal-network"
# Default name var is in the module main file
admin_state_up = var.admin_state_up
enable_dhcp = var.enable_dhcp
}
# calls the outputs defined in the internal-network module
output "internal_network_id" {
value = module.cluster-network.internal_network_id
}
# runs the floating-ip module - uses public network name defined above
# runs the floating-ip module - uses public network name defined above
module "floating-ip-address" {
module "floating-ip-address" {
source = "./floating-ip"
source = "./floating-ip"
@@ -70,17 +41,19 @@ output "keypair_name" {
@@ -70,17 +41,19 @@ output "keypair_name" {
value = module.import-keypair.keypair_name
value = module.import-keypair.keypair_name
}
}
 
data "openstack_networking_network_v2" "external_net" {name = var.external_network}
 
data "openstack_networking_network_v2" "internal_net" {name = var.internal_network}
 
# runs the ohpc-instance module - creates ohpc instance using variables defined above
# runs the ohpc-instance module - creates ohpc instance using variables defined above
# calls functions from dmz-network, import-keypair, and floating-ip-address modules to get values created there for use
# calls functions from dmz-network, import-keypair, and floating-ip-address modules to get values created there for use
module "create-ohpc-instance" {
module "create-ohpc-instance" {
external_subnet_id = module.dmz-network.external_subnet_id
source = "./ohpc-instance"
source = "./ohpc-instance"
ohpc_instance_name = var.ohpc_instance_name
ohpc_instance_name = var.ohpc_instance_name
image_ohpc = var.image_ohpc
image_ohpc = var.image_ohpc
flavor = var.flavor
flavor = var.flavor
key_pair = module.import-keypair.keypair_name
key_pair = module.import-keypair.keypair_name
external_network = var.external_network
external_network = data.openstack_networking_network_v2.external_net.id
internal_network = var.internal_network
internal_network = data.openstack_networking_network_v2.internal_net.id
internal_ip = var.ohpc_private_ip
internal_ip = var.ohpc_private_ip
floating_ip_ohpc = module.floating-ip-address.ohpc_address
floating_ip_ohpc = module.floating-ip-address.ohpc_address
ohpc_user = var.ohpc_user
ohpc_user = var.ohpc_user
@@ -107,13 +80,12 @@ module "create-ohpc-instance" {
@@ -107,13 +80,12 @@ module "create-ohpc-instance" {
# runs the nodes module - creates nodes using variables defined above
# runs the nodes module - creates nodes using variables defined above
# calls functions from cluster-network and import-keypair modules to get values created there for use
# calls functions from cluster-network and import-keypair modules to get values created there for use
module "nodes" {
module "nodes" {
internal_subnet_id = module.cluster-network.internal_subnet_id
source = "./nodes"
source = "./nodes"
image_compute = var.image_compute
image_compute = var.image_compute
flavor = var.flavor
flavor = var.flavor
key_pair = module.import-keypair.keypair_name
key_pair = module.import-keypair.keypair_name
compute_node_count = var.compute_node_count
compute_node_count = var.compute_node_count
internal_network = var.internal_network
internal_network = data.openstack_networking_network_v2.internal_net.id
}
}
# calls the outputs defined in the ohpc-instance module
# calls the outputs defined in the ohpc-instance module
@@ -137,21 +109,31 @@ resource "null_resource" "ops" {
@@ -137,21 +109,31 @@ resource "null_resource" "ops" {
connection {
connection {
host = module.create-ohpc-instance.ssh_host
host = module.create-ohpc-instance.ssh_host
user = var.ohpc_user
user = var.ohpc_user
private_key = file(var.ssh_private_key)
private_key = var.ssh_private_key
}
}
 
provisioner "remote-exec" {
 
inline = [
 
"ls -al /CRI_XCBC",
 
]
 
}
# moves CRI_XCBC file into directory made above
# moves CRI_XCBC file into directory made above
provisioner "file" {
source = "CRI_XCBC"
provisioner "remote-exec" {
destination = "/"
inline = [
 
"sudo sed -i -E 's/xdmod..nip.io/xdmod.rc.uab.edu/g' /etc/httpd/conf.d/xdmod.conf",
 
"sudo sed -i -E 's/xdmod..nip.io/xdmod.rc.uab.edu/g' /etc/xdmod/simplesamlphp/config/config.php",
 
"sudo systemctl restart httpd",
 
]
}
}
# compute node
# compute node registration on ohpc
provisioner "remote-exec" {
provisioner "remote-exec" {
inline = [
inline = [
for node, net in module.nodes.network:
for node, net in module.nodes.network:
"ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` -e \"{'compute_nodes':[{'name':'${node}', 'ip':'${net[0].fixed_ip_v4}', 'mac':'${net[0].mac}', 'vnfs':'', 'sockets':'1', 'corespersocket':'1'}]}\" /CRI_XCBC/site-ops.yaml -b -v"]
"ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` -e \"{'cod_deploy':'false', 'compute_nodes':[{'name':'${node}', 'ip':'${net[0].fixed_ip_v4}', 'mac':'${net[0].mac}', 'vnfs':'', 'sockets':'1', 'corespersocket':'1'}]}\" /CRI_XCBC/site-ops.yaml -b -v"
 
]
}
}
# ood node
# ood node
Loading