0% found this document useful (0 votes)
44 views

Devops Lab Manual

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Devops Lab Manual

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

AGNI COLLEGE OF TECHNOLOGY

(Approved by AICTE & Affiliated to Anna University)

Off Old Mahabalipuram Road,Thalambur,Chennai -600130

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


ACADEMIC YEAR
CCS342 –DEVOPS LABORATORY
EVEN SEMESTER
2023-2024

NAME OF THE STUDENT :


REGISTER NUMBER :
COURSE :
YEAR :

SEMESTER :
AGNI COLLEGE OF TECHNOLOGY
(Approved by AICTE& Affiliated to Anna University)
Old Mahabalipuram Road, Thalambur, Chennai – 600 130

BONAFIDE CERTIFICATE

Register Number :

Name of the lab : CCS342 DEVOPS LABORATORY

Department : Computer Science and Engineering

Certified that this is a Bonafide Record of Practical Work done by


Mr./Ms.………………………………………………………………………………………....
of Computer Science and Engineering Department 6th semester in the CCS342 DEVOPS LABORATORY
during the year 2023-2024.

Signature of Lab-in-Charge Signature of Head of the Department

Submitted for the University Practical Examination held on …………………

INTERNAL EXAMINER EXTERNAL EXAMINER


lOMoAR cPSD| 28043727

TABLE OF CONTENT

EX NO DATE NAME OF THE EXPERIMENT SIGNATURE


Create Maven Build Pipeline in Azure.
1
Run regression tests using Maven Build pipeline in
2 Azure.
Install Jenkins in Cloud
3
Create CI pipeline using Jenkins
4
Create a CD pipeline in Jenkins and deploy in Cloud
5
Create an Ansible Playbook for a simple web
6 application infrastructure.
Build a simple application using Gradle.
7
Install Ansible and configure ansible roles and to
8 write playbooks.
lOMoAR cPSD| 28043727

Ex. No: 1
Date : Create Maven Build Pipeline in Azure

AIM:
The aim is to create a Maven Build pipeline in Azure DevOps. This
pipeline will automate the process of building and packaging a Java
project using Maven.

ALGORITHMS:
lOMoAR cPSD| 28043727

PROGRAM:

Yaml

Example Azure DevOps YAML configuration for Maven Build Pipeline


trigger:

- master

pool:
vmImage: 'ubuntu-latest'

steps:
- task:
MavenAuthenticate@0
inputs:
mavenServiceConnection: 'YourMavenServiceConnection'
mavenPomFile: 'path/to/your/pom.xml'
options: '-Xmx3072m'

- task: Maven@3
inputs:
mavenPomFile: 'path/to/your/pom.xml'
goals: 'clean package'
options: '-Xmx3072m'
lOMoAR cPSD| 28043727

OUTPUT:

The output of the pipeline will be displayed in the Azure DevOps pipeline execution
logs. It will include information about each step of the build process, such as Maven
dependencies resolution, compilation, testing, packaging, and any other configured
goals.

RESULT:

Upon successful execution of the pipeline, a packaged artifact (e.g., JAR file)
generated by Maven. This artifact can be deployed to other environments for
further testing or production use.
lOMoAR cPSD| 28043727

Ex. No: 2
Date : Run regression tests using Maven Build pipeline in Azure

AIM:

The aim is to extend the Maven Build pipeline created earlier to include the execution of
regression tests. This will ensure that the automated tests are integrated into the
continuous integration process.

ALGORITHM:
lOMoAR cPSD| 28043727

PROGRAM:

Yaml

Updated Azure DevOps YAML configuration for Maven Build Pipeline with
Regression Tests
trigger:
- master

pool:
vmImage: 'ubuntu-latest'

steps:
- task:
MavenAuthenticate@0
inputs:
mavenServiceConnection: 'YourMavenServiceConnection'
mavenPomFile: 'path/to/your/pom.xml'
options: '-Xmx3072m'

- task: Maven@3
inputs:
mavenPomFile: 'path/to/your/pom.xml'
goals: 'clean package test'
options: '-Xmx3072m
lOMoAR cPSD| 28043727

OUTPUT:

The output of the pipeline will now include the results of the regression tests.
Test reports, logs, and any failures will be displayed in the Azure DevOps pipeline
execution logs.

RESULT:

Upon successful execution of the pipeline, it will be able to review the


test results in Azure DevOps. If any regression tests fail, the pipeline will
indicate the issues, allowing for quick identification and resolution.
lOMoAR cPSD| 28043727

Ex. No: 3
Date : Install Jenkins in Cloud

AIM:

The aim is to install Jenkins on a cloud platform, providing a scalable


and centralized solution for continuous integration and continuous
delivery (CI/CD) processes.

ALGORITHM:
lOMoAR cPSD| 28043727

OUTPUT:

Access Jenkins through the web browser, and you should see the Jenkins dashboard.
Now we can start creating jobs, pipelines, and integrate Jenkins with your version control
system.

RESULT:

Jenkins is successfully installed on the virtual machine in the cloud. You


can use Jenkins to automate build, test, and deployment processes, improving
the efficiency of your development workflow.
lOMoAR cPSD| 28043727

Ex. No: 4
Date : Create Cl pipeline using Jenkins

AIM:

The aim of this lab is to create a Continuous Integration pipeline in Jenkins, which
automates the build and test process whenever changes are pushed to the version
control system.

ALGORITHM:
lOMoAR cPSD| 28043727

OUTPUT:

Viewing the console output of the pipeline to monitor the build and test process. The
console output will show the progress of each stage and any errors or failures encountered during
the pipeline execution.

RESULT:

Upon successful execution, Jenkins pipeline will have automated the build
and test process of project. Future changes pushed to the version control system
will trigger Jenkins to automatically build and test your project, providing
continuous integration and early detection of issues.
lOMoAR cPSD| 28043727

Ex. No: 5
Date : Create a CD pipeline in Jenkins and deploy in Cloud

AIM:

The aim of this lab is to enhance the existing Jenkins pipeline to include
deployment steps, allowing for continuous delivery of your application to a cloud
environment.

ALGORITHM:
lOMoAR cPSD| 28043727

OUTPUT:

Viewing the console output of the extended pipeline to monitor the


deployment process. The console output will show the progress of each stage,
including the deployment steps.

RESULT:

Upon successful execution, your Jenkins pipeline will automate the


deployment of your application to the cloud. Changes pushed to the version
control system will trigger Jenkins to build, test, and deploy application,
providing continuous delivery to cloud environment.
lOMoAR cPSD| 28043727

Ex. No: 6
Date : Create an Ansible playbook for a simple web
application infrastructure

AIM:

The aim of this lab is to use Ansible to automate the setup of a simple web application
infrastructure.

ALGORITHM:

Yaml

---
- name: Setup Web Application Infrastructure
hosts: web_servers
become: true

tasks:
- name: Install Nginx
apt:
name: nginx
state: present

- name: Configure Nginx


template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
notify: Reload Nginx

- name: Install MySQL


apt:
name: mysql-server
state: present
lOMoAR cPSD| 28043727

. - name: Secure MySQL Installation


mysql_secure_installation:
login_user: root
login_password: "{{ mysql_root_password }}"
new_password: "{{ mysql_root_password }}"
validate_password: no

handlers:
- name: Reload Nginx
service:
name: nginx
state: reloaded

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
worker_connections 768;
}

http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;
lOMoAR cPSD| 28043727

server {
listen 80;
server_name {{ ansible_fqdn }};
root /var/www/html;

location / {
index index.html;
}

error_page 500 502 503 504 /50x.html;


location = /50x.html {
root /usr/share/nginx/html;
}
}
}

[web_servers]
web_server ansible_host=your_web_server_ip
ansible_user=your_ssh_user

[database_servers]
db_server ansible_host=your_db_server_ip
ansible_user=your_ssh_user

ansible-playbook -i inventory.ini web_app_infrastructure.yml --extra-


vars "mysql_root_password=your_mysql_root_password"
lOMoAR cPSD| 28043727

OUTPUT:

The console output as Ansible runs the playbook. It will display the progress of
eachtask and report any errors encountered.

RESULT:

Upon successful execution of the Ansible playbook, web servers will have
Nginx installed and configured, and database server will have MySQL installed and
secured. The web application infrastructure is now set up according to the defined
specifications.
lOMoAR cPSD| 28043727

Ex. No: 7 Build a simple application using Gradle


Date :

AIM:

The aim of this lab is to create a simple Java application and use Gradle to build
and manage dependencies.

ALGORITHM:
lOMoAR cPSD| 28043727
lOMoAR cPSD| 28043727

OUTPUT:

The output in the terminal as Gradle downloads dependencies, compiles the code,
andbuilds the JAR file.

RESULT:

Upon successful execution, a simple Java application built with Gradle.


This project can be extended by adding more classes, dependencies, and
configurations to meet the requirements of application.
lOMoAR cPSD| 28043727

Ex. No: 8 Install Ansible and configure ansible roles and to write playbooks
Date :

AIM:
The aim of this lab is to install Ansible, configure Ansible roles, and write
playbooksfor managing configurations on target machines.

ALGORITHM:
lOMoAR cPSD| 28043727
lOMoAR cPSD| 28043727
lOMoAR cPSD| 28043727

OUTPUT:

The output in the terminal as Ansible executes tasks defined in the playbooks and roles.

RESULT:

Upon successful execution of the playbooks, target machines will be


configured based on the roles and tasks defined. Ansible will manage
configurations, ensuring consistency across infrastructure.

You might also like