Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Terraform Openstack
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ryan Randles Jones
Terraform Openstack
Commits
356db93b
Commit
356db93b
authored
6 years ago
by
Ryan Randles Jones
Browse files
Options
Downloads
Plain Diff
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
!5
Tester
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
.gitmudules
+4
-0
4 additions, 0 deletions
.gitmudules
README.md
+16
-5
16 additions, 5 deletions
README.md
datasources.tf
+1
-1
1 addition, 1 deletion
datasources.tf
main.tf
+16
-6
16 additions, 6 deletions
main.tf
output.tf
+7
-3
7 additions, 3 deletions
output.tf
vars.tf
+0
-5
0 additions, 5 deletions
vars.tf
with
44 additions
and
20 deletions
.gitmudules
0 → 100644
+
4
−
0
View file @
356db93b
[submodule "CRI_XCBC"]
path = CRI_XCBC
url = https://github.com/jprorama/CRI_XCBC.git
branch = feat-openstack
This diff is collapsed.
Click to expand it.
README.md
+
16
−
5
View file @
356db93b
# Terraform Openstack
Right now, t
his will create:
T
his 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
OPEN
RCFILENAME`
`$source
CREDENTIAL
RCFILENAME`
`$cd terraform-openstack`
...
...
This diff is collapsed.
Click to expand it.
datasources.tf
+
1
−
1
View file @
356db93b
data
"openstack_networking_network_v2"
"borderrouter"
{
name
=
"
${
var
.
pool
}
"
name
=
"
${
var
.
pool
}
"
}
This diff is collapsed.
Click to expand it.
main.tf
+
16
−
6
View file @
356db93b
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"
...
...
This diff is collapsed.
Click to expand it.
output.tf
+
7
−
3
View file @
356db93b
...
...
@@ -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
}
"
}
This diff is collapsed.
Click to expand it.
vars.tf
+
0
−
5
View file @
356db93b
...
...
@@ -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."
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment