Using Jenkins pipeline to provision infrastructure. using Ansible to configure the bastion host and the application server as slave for jenkins to run on it a Node.js app that connects to RDS and ElastiCache Redis instances in private subnets
Run jenkins master as container on local machine
# build the custom image that contains ansible and docker client
cd jenkins
docker build -t <imageName> -f jenkins_master.dockerfile .
# run the image
docker run --name <containerName> -p8080:8080 -d -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/terraform:/usr/bin/terraform <imageName>
Hit the jenkins master at http://localhost:8080/
Then, go to the Jenkins page and configure it as follows:
-
Add AWS credentials to Jenkins
-
Create a parameterized pipeline
Build the infrastructure choose apply
Goto "Manage Nodes and Clouds" => "New Node"
Create a new pipeline for the application link
open browser and type the ALB url
Build the pipeline a gain and choose destroy