Skip to content
Snippets Groups Projects
Commit 356db93b authored by Ryan Randles Jones's avatar Ryan Randles Jones
Browse files

Merge branch 'tester' into 'master'

Tester

See merge request rrand11/terraform-openstack!5
parents fceabc50 7dce0225
No related branches found
No related tags found
1 merge request!5Tester
[submodule "CRI_XCBC"]
path = CRI_XCBC
url = https://github.com/jprorama/CRI_XCBC.git
branch = feat-openstack
# Terraform Openstack
Right now, this will create:
This will create:
dmznet and dmzsubnet
......@@ -11,6 +11,7 @@ a floating ip address, and an instance coming off of dmznet
clusternet off of dmznet instance
clustersubnet
eill connect instance to ood through ohpc and download software
Make a new directory for Terraform:
......@@ -26,15 +27,25 @@ Unzip the file and make a path to your new directory:
`$cp $HOME/Downloads/terraform_0.6.16_linux_amd64/terraform $TERRAFORM_DIR`
Download RC File from Openstack(V3) and save it in your terraform-first-instance directory.
Create a new application credintial in Openstack:
In Openstack, go to Identity - Application Credentials
Click "Create Application Credential"
Name the credential and add a description(Leave the rest blank. It is important not to add an expiration date.)
Open the credential rc file you have created, and change all OS_ to TF_. This will allow terraform to read and use these values.
Save the credential in your terraform-first-instance directory.
Clone this repo into your terraform-first-instance directory:
`$git clone https://gitlab.rc.uab.edu/rrand11/terraform-openstack.git`
`$git clone --recursive https://gitlab.rc.uab.edu/rrand11/terraform-openstack.git`
Source the rc file and initialize terraform:
Source the credential rc file and initialize terraform:
`$source OPENRCFILENAME`
`$source CREDENTIALRCFILENAME`
`$cd terraform-openstack`
......
data "openstack_networking_network_v2" "borderrouter" {
name = "${var.pool}"
name = "${var.pool}"
}
resource "openstack_compute_keypair_v2" "ohpc-keypair" {
name = "my-keypair"
resource "openstack_compute_keypair_v2" "keypair" {
name = "my-keypair"
public_key = "${file("~/.ssh/id_rsa.pub")}"
}
#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")}"
}
}
# creates dmznet
......@@ -57,7 +67,7 @@ depends_on = ["openstack_networking_subnet_v2.dmzsubnet"]
name = "ohpc"
image_name = "${var.image}"
flavor_name = "${var.flavor}"
key_pair = "${openstack_compute_keypair_v2.ohpc-keypair.name}"
key_pair = "${openstack_compute_keypair_v2.keypair.name}"
security_groups = ["default"]
# defines the networks of the instance
......@@ -78,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 = "${file(var.ssh_key_private)}"
private_key = "${file("~/.ssh/id_rsa")}"
}
inline = [
......@@ -98,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 = "${file(var.ssh_key_private)}"
private_key = "${file("~/.ssh/id_rsa")}"
}
}
......@@ -107,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 = "${file(var.ssh_key_private)}"
private_key = "${file("~/.ssh/id_rsa")}"
}
inline = [
"sudo ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` /CRI_XCBC/site.yaml -b"
......
......@@ -2,6 +2,10 @@ output "address" {
value = "${openstack_networking_floatingip_v2.ip_pool.address}"
}
output "terraform-provider" {
value = "Connected with OpenStack at ${var.auth_url}"
}
\ No newline at end of file
output "dmznet_network_id" {
value = "${openstack_networking_network_v2.dmznet.id}"
}
output "clusternet_network_id" {
value = "${openstack_networking_network_v2.clusternet.id}"
}
......@@ -9,8 +9,3 @@ variable "flavor" {
variable "pool" {
default = "bright-external-flat-externalnet"
}
variable "ssh_key_private" {
default = "~/.ssh/id_rsa"
description = "Path to the SSH public key for accessing cloud instances. Used for creating AWS keypair."
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment