Rassco - FOTOLIA

Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

DevOps lab: Learn to use GitHub for infrastructure deployments

This article is part of a series to help IT ops professionals learn DevOps by building a home lab. In the second step, Git version control allows ops to manage infrastructure as code.

A DevOps deployment requires quickly provisioned infrastructure that adapts to application needs. The Vagrant VM workflow in the DevOps lab build's first step yielded some files containing code that creates and describes the lab infrastructure. Git version control software, or other preferred infrastructure as code tools, protects that code and archives older versions as we make changes.

A Git commit saves a consistent state -- a separate copy -- of the project on the DevOps lab machine. It enables the user to return to a previous fixed point if changes mess up the code. Learn to use GitHub, a distributed version control platform, as the central repository for infrastructure code, freeing saved versions from only existing on one computer.

Create a
DevOps lab

Before checking in infrastructure as code using Git and GitHub, install Vagrant and spin up the VMs for this DevOps lab as immutable infrastructure. Or start here to get the lab up and running.

Start using Git

Install Git on the lab machine; it might automatically install when git runs for the first time. Have the terminal open in your project folder where the Vagrantfile resides.

Configure Git to let it know who you are with some config commands and your name and email address:

Set up Git

Then initialize Git in that folder, add the VagrantFile and commit the current file with the following commands:

Commit to Git

Make changes in the DevOps lab freely; you can be confident that the deployment can roll back to this state at any time. Use GitHub to commit any time you make a significant and successful change. Use git add to add any new files. Try wild cards like git add *.sh to add all the shell scripts. During the following DevOps learning exercises, I will remind you to commit changes along the way.

The files for the experiments in this article are available to clone from my GitHub repository:

A GitHub repository

Clone the files then copy some to your project folder. Then make all of the shell scripts executable:

Shell scripts in Git

Author's note: There are a few listings that are too long to include in the text of this article, but are available in the repository.

Continue building this DevOps lab

With a basic grasp of how to use GitHub and Vagrant from these tutorials, begin working with Ansible to implement consistent configurations on one or multiple infrastructure stacks.

Next Steps

Look around GitHub for projects from other systems administrators for data center automation and cloud management utilities

Get into the tools and services to build infrastructure as code

This was last published in April 2017

Dig Deeper on Managing Virtual Containers

PRO+

Content

Find more PRO+ content and other member only offers, here.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

How often does your ops team provision new infrastructure or scale up an existing deployment?
Cancel

-ADS BY GOOGLE

SearchDataCenter

SearchAWS

SearchServerVirtualization

SearchCloudApplications

SearchCloudComputing

Close