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
94917cb9
Commit
94917cb9
authored
1 year ago
by
Eesaan Atluri
Browse files
Options
Downloads
Patches
Plain Diff
Shutoff instance before vol snapshot instead of turning off services by sshing in
parent
352c3360
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+2
-9
2 additions, 9 deletions
.gitlab-ci.yml
with
2 additions
and
9 deletions
.gitlab-ci.yml
+
2
−
9
View file @
94917cb9
...
...
@@ -43,20 +43,13 @@ prep-deploy:
export prod_instance_id=$(openstack floating ip show $prod_floating_ip -c port_details -f value | awk -F', ' '{print $2}' | awk -F"'" '{print $2}')
export prod_volume=$(openstack server show $prod_instance_id -c volumes_attached -f value | awk -F"'" '{print $4}')
echo "Detaching prod_volume=${prod_volume} from prod_instance_id=${prod_instance_id} and creating a snapshot"
eval $(ssh-agent -s)
chmod 400 "${SSH_PRIV_KEY}"
ssh-add "${SSH_PRIV_KEY}"
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh -o StrictHostKeyChecking=no $SSH_USERNAME@$prod_floating_ip sudo systemctl stop mariadb
ssh -o StrictHostKeyChecking=no $SSH_USERNAME@$prod_floating_ip sudo umount /var/lib/mysql && df -h
openstack server stop $prod_instance_id
openstack server remove volume $prod_instance_id $prod_volume
openstack volume snapshot create --volume $prod_volume xdmod-prod-vol-snapshot-$BUILD_DATE
echo "Reattach the prod_volume=${prod_volume} to prod_instance_id=${prod_instance_id} after snapshot is created"
openstack server start $prod_instance_id
openstack server add volume $prod_instance_id $prod_volume --device /dev/vdb
ssh -o StrictHostKeyChecking=no $SSH_USERNAME@$prod_floating_ip sudo mount /dev/vdb1 /var/lib/mysql && df -h
ssh -o StrictHostKeyChecking=no $SSH_USERNAME@$prod_floating_ip sudo systemctl start mariadb
echo "Make a copy of prod volume $prod_volume to be used in tf-apply"
TF_VAR_data_volume="xdmod-prod-vol-$BUILD_DATE"
...
...
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