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
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Krish Moodbidri
Terraform Openstack
Commits
d04ff7c5
Commit
d04ff7c5
authored
1 year ago
by
Ravi Tripathi
Browse files
Options
Downloads
Patches
Plain Diff
Add job for floating ip swap in staging env
parent
c32d2edc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+33
-0
33 additions, 0 deletions
.gitlab-ci.yml
main.tf
+5
-1
5 additions, 1 deletion
main.tf
ohpc-instance/main.tf
+1
-1
1 addition, 1 deletion
ohpc-instance/main.tf
with
39 additions
and
2 deletions
.gitlab-ci.yml
+
33
−
0
View file @
d04ff7c5
...
...
@@ -95,6 +95,39 @@ tf-apply:
TF_SUCCESS=true
fi
echo "Terraform success: $TF_SUCCESS"
-
export instance_floating_ip=$(terraform output -raw floating_ip_ohpc)
-
export instance_id=$(terraform output -raw xdmod_instance_id)
-
echo "instance_floating_ip=${instance_floating_ip}" | tee -a $CI_PROJECT_DIR/vars.env
-
echo "instance_id=${instance_id}" | tee -a $CI_PROJECT_DIR/vars.env
artifacts
:
reports
:
dotenv
:
vars.env
staging-post-deploy
:
environment
:
name
:
staging
stage
:
build
tags
:
[
build
]
script
:
-
export staging_floating_ip="138.26.49.15"
-
export old_instance_id=$(openstack floating ip show $staging_floating_ip -c port_details -f value | awk -F', ' '{print $2}' | awk -F"'" '{print $2}')
-
echo "staging_floating_ip=${staging_floating_ip}"
-
echo "old_instance_id=${old_instance_id}"
-
|
if [[ -n "$old_instance_id" ]]; then
openstack server remove floating ip $old_instance_id $staging_floating_ip
openstack server delete $old_instance_id
fi
-
openstack server remove floating ip $instance_id $instance_floating_ip
-
openstack server add floating ip $instance_id $staging_floating_ip
-
openstack floating ip delete $instance_floating_ip
needs
:
-
job
:
tf-apply
artifacts
:
true
rules
:
-
if
:
'
$TARGET_ENV
==
"staging"'
clean-up
:
stage
:
cleanup
...
...
This diff is collapsed.
Click to expand it.
main.tf
+
5
−
1
View file @
d04ff7c5
...
...
@@ -108,6 +108,10 @@ output "ohpc-ssh_host" {
value
=
module
.
create-ohpc-instance
.
ssh_host
}
output
"xdmod_instance_id"
{
value
=
module
.
create-ohpc-instance
.
xdmod_instance_id
}
# calls the outputs defined in the ood-instance module
#output "ood-ssh_host" {
# value = module.create-ood-instance.ssh_host
...
...
@@ -118,7 +122,7 @@ output "ohpc-ssh_host" {
# that lead to inconsistent deploy successes.
resource
"null_resource"
"ops"
{
triggers
=
{
ohpc_instance
=
module
.
create-ohpc-instance
.
id
ohpc_instance
=
module
.
create-ohpc-instance
.
xdmod_instance_
id
compute_instances
=
join
(
","
,
module
.
nodes
.
id
)
}
...
...
This diff is collapsed.
Click to expand it.
ohpc-instance/main.tf
+
1
−
1
View file @
d04ff7c5
...
...
@@ -67,7 +67,7 @@ resource "openstack_compute_volume_attach_v2" "volume_attach" {
volume_id
=
var
.
vol_id
}
output
"id"
{
output
"
xdmod_instance_
id"
{
value
=
openstack_compute_instance_v2
.
ohpc
.
id
}
...
...
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