Skip to content

Using Jenkins Pipelines to Manage Environments with Infrastructure as Code - Ansible, AWS

Notifications You must be signed in to change notification settings

Djrohith/Infrastructure-as-code-ansible

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IAC

Using Pipelines to Manage Environments with Infrastructure as Code - Jenkins, Ansible, AWS

This repository shows a very simple example of using Jenkins pipeline to manage AWS Cloud Environment with Ansible Playbooks and roles. It refers some code from my another repo https://github.com/devopscripts/aws which is a sample code of using Ansible to setup AWS VPC, Subnet, Security Group, EC2, ELB2 and etc from scratch.

This repo has two branch, just want to keep it as simple, master and development. The development branch is used to develop infrastructure codes, ansible playbooks and roles in this case. The master branch contains the code after testing merged from development branch.

Jenkins pipeline has two stages: deploy-test and deploy-prod(as I said to keep it simple). Everytime infrastructure engineer commits a change to development branch, Jenkins will start the pipeline to build. In this case, deploy-test will be executed and deploy-prod will be skipped.

When deploy-test is successful, we may want to consider merge to the master and deploy to production environment. Of course, we should perform code review with co-workers before doing that. When development code is merged to master branch, Jenkins will start the pipelien again. But this time, the deploy-prod will be execute and deploy-test will be skipped.

To deploy code to different environments test and prod, different ansible variables input are used in this example. Production variables are placed in prodvar.yml, and test variables are placed in testvar.yml.

About

Using Jenkins Pipelines to Manage Environments with Infrastructure as Code - Ansible, AWS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published