0% found this document useful (0 votes)
10 views71 pages

DevOps Lab Manual for CCS342 Course

The document is a lab manual for the CCS342 DevOps course at the University College of Engineering Kancheepuram. It outlines various exercises related to creating build and deployment pipelines using tools like Maven, Jenkins, and Gradle. Each exercise includes aims, procedures, and results, demonstrating the practical applications of DevOps methodologies.

Uploaded by

badri2006nathan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views71 pages

DevOps Lab Manual for CCS342 Course

The document is a lab manual for the CCS342 DevOps course at the University College of Engineering Kancheepuram. It outlines various exercises related to creating build and deployment pipelines using tools like Maven, Jenkins, and Gradle. Each exercise includes aims, procedures, and results, demonstrating the practical applications of DevOps methodologies.

Uploaded by

badri2006nathan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

lOMoARcPSD|35618914

CCS342 - Devops Lab Manual

digital and mobile forensics (University College of Engineering)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Anusiya. T (anu13akshaya26@[Link])
lOMoARcPSD|35618914

UNIVERSITY COLLEGE OF ENGINEERING KANCHEEPURAM


(A Constituent college of Anna University Chennai)
KANCHIPURAM - 631 552

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CCS342 – DEVOPS

Name:
Register no:
Year/Semester: Branch:

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

UNIVERSITY COLLEGE OF ENGINEERING KANCHEEPURAM


(A Constituent college of Anna University Chennai)
KANCHIPURAM - 631 552

BONAFIDE CERTIFICATE

REGISTER NO

Certified that this is the bonafide record of work done by


Mr/Ms............................................... of ...... semester B.E. Computer Science
and Engineering Branch / Batch during the academic year 20...... to 20….. in the
CCS342 — DEVOPS.

Staff In-Charge Head of the Department

Submitted for the University Practical examination held on ...........................

Internal Examiner External Examiner

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

TABLE OF CONTENTS

Ex Date Title Page Signature


No No

01 Create Maven Build Pipeline in Azure

02 Run regression tests using Maven


Build pipeline in Azure

03 Install Jenkins in Cloud

04 Create CI pipeline using Jenkins

05 Build a simple application using


Gradle

06 Install Ansible and Configure Ansible


Roles and to write playbooks

07 Create a CD pipeline in Jenkins and


deploy in Cloud

08 Create an Ansible playbook for a


simple web application infrastructure

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

[Link] Create Maven Build Pipeline in Azure


Date:

Aim:
To create maven build pipeline in Azure
Procedure:
Step 1: Install Apache Maven Zip file

Step 2: Go to folder where apache maven downloaded

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 3: Right Click & Extract the Zip file

Step 4: Click the Extracted file

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 5: Select bin folder

Step 6: Copy bin folder path

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 7: Open Environmental Variable

Step 8: Select path and click edit

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 9: Click New and paste the copied path

Step 10: Click ok

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 11: Open Command Prompt


>> mvn --version

Step 12: Maven Verified

Result:
Thus, creating maven build pipeline in Azure done successfully.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

[Link]: 2 Run regression tests using Maven Build pipeline in Azure


Date:

Aim:
To run regression tests using Maven Build pipeline in Azure.
Procedure:
Step 1: Download Eclipse and install Eclipse IDE for java Developers

Step 2: Open file select new and create maven project

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 3: Just Click next

Step 4: In New Maven project select Maven-archetype-webapp Version 1.4 and Click
next

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 5: Provide the Group Id and Artifact Id then click finish

Step 6: Creating maven-archetype-webapp


At 33% completion it will ask Y :: y
type y and it will continue the process

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 7: It Shows Build Success

Step 8: Click app1 -> src -> main -> webapp -> WEB –INF

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 9: Right click on WEB-INF select new and click on file

Step 10: create new file and click finish

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 11: Create a simple HTML program

Step 12: Run html program in web browser

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 13: Output Verified

Result:
Thus regression tests using Maven Build pipeline in Azure done successfully.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

[Link] Install Jenkins in Cloud


Date:

Aim:
To install Jenkins in Cloud.
Procedure:

Step:1 Download Jenkins from jenkins official page


Note: Java JDK version must be 11 / 17/ 21 to install Jenkins on windows

Step:2 Click the downloaded file and run as administrator

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:3 Click next to install

Step:4 Enter service credentials for the service and click next

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:5 Choose a port for the service and click next

Step:6 Select java home directory and click next

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:7 Select the features to be installed and click next

Step:8 Click install to begin the installation

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:9 Click finish the button to exit the setup

Step:10 Goto google and search locolhost 8080

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:11 Opening localhost 8080

Step:12 Unlock jenkins

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:13 Goto jenkins folder and search for intial admin password

Step:14 Copy the password

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:15 To unlock jenkins paste the password and click continue

Step:16 Click install suggested plugins

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:17 plugins installation

Step:18 Create Admin User & click save and continue

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:19 Configure jenkins & click save and continue

Step:20 Jenkins setup is complete & click start using jenkins

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step:21 Welcome to jenkins page

Result:
Thus installing Jenkins in Cloud done successfully.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

[Link] Create CI pipeline using Jenkins


Date:

Aim:
To create CI pipeline using Jenkins.
Procedure:
Step1:Go to jenkins page using localhost 8080

Step 2: Enter an item name as Build and Click Freestyle project& click ok.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 3: From Configure click Build steps and scroll down the page.

Step 4: Click Execute windows batch command as shown below

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 5: In command window give a message using echo and click apply and save.

Step 6: The below page will be generated after apply and save.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 7: The same procedure will be followed for creating Deploy [refer step 2 to step 6].
After creating Deploy the below page will be generated and click on the new item.

Step 8: Enter an item name as Test &click on freestyle project and click ok.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 9: Click apply and save.

Step 10: The below page will be generated after apply and save

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 11: The same procedure will be followed for creating Release [refer test step 9, 10].
After creating Deploy the below page will be generated and click on the new item

Step 12: Click the Build item and Click on the Configure.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 13: Click the Build Steps in Execute Window batch command and click the Build
other Projects on drop down list.

Step 14: Click on the Post build actions in Build other project enter the Deploy as in next
item name to connect here and click the Trigger only if build is stable, Click apply
and save.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 15: In Build item –>Downstream project ->Click Deploy.

Step 16: After clicking on the Deploy the below page will be displayed Upstream projects as
Build.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 17: The same procedure will be followed for connecting the Test [refer step 12 to 16].
After creating Deploy the below page will be generated and click on the new item,
connecting the below page is displayed. It shows Upstream project as Build and
Downstream project as Test.

Step 18: After connecting all these items with each other the below page is display. Click
the Release item.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 19: Go to configure & click the Build Triggers ->Build after projects are built, Now in
“project to match” give the Test and click on the “Trigger only if build is stable”, Click
apply and save.

Step 20: After clicking the below page will be displayed the Test as upstream project. Click
on the Test.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 21: After connecting all the items together below image will display. If we run the
Build item the connecting Deploy item will display on the Build Queue.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 22: Go to Mange Jenkins scroll down the page and click on plugins.

Step 23: Click on the Installed plugins and check the Pipeline and enable it.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 24: Go to Available plugins and install the Lockable Resources.

Step 25: After installing, the Pipeline Click on New item and Enter an item name as
MyPipeline & click on the Pipeline and click ok to finish.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 26 : After Creating the below page will displayed and click on the Pipeline in side bar
and Choose the Pipeline Script as Definition and Choose the Script default select the Hello
world Program in the drop down menu.

Step 27: After Clicking it the below page is display, Click on the Use Groovy Sandbox
and Click Apply and Save.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 28: After creating the Pipeline the below page is display and click on the run button to
run the program and open it.

Step 29: After opening the page the below page will display and Click on the Hello.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 30: After Clicking Hello the below page will displayed and click on the Logs.

Step 31: By clicking on the Logs the output will display on the top of the screen like below
image.

Result:
Thus, Creating CI pipelines using Jenkins done successfully.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

[Link] Build a simple application using Gradle

Date:
Aim:
Build a simple application using Gradle

Procedure:

Step 1: Download gradle from official website

Step 2: Go to downloads and extract the gradle folder

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 3: Extracted gradle folder

Step 4: Copy the bin path from gradle folder

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 5: Search environment variable to edit the path

Step 6: Click environment variable

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 7: Click new and paste the variable name & variable value as below

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 8: In path click edit and paste gradle path

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 9: Create a new folder in gradle

Step 10: Open command prompt in that folder refer below picture

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 11: Command prompt opened

Step 12: Type the command gradle init and press enter .Now Select the type of project to
generate and we choose number 2 [application]

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 13: Select the implementation language and we choose number 3 [Java]

Step 14: Type NO to generate multiple subprojects for application

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 15: Select build script DSL and we choose 2 [Groovy]

Step16: Select test framework and we choose number 3 [Spock]

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 17: Give project name as sample and enter

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 18: Type NO to generate build using new APIs and it gives the Task: init and
display the message as BUILD SUCCESSFUL

Step 19: Now run gradle using the command gradle run

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 20: It gives the output as Hello World!

Result

Thus, a simple application using Gradle was Build successfully.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Ex.N0:6 Install Ansible and Configure Ansible Roles and


Date: to write playbooks

Aim:
To install Ansible ,Configure Ansible roles and to write playbooks
Procedure:
Step 1: Install Cygwin64 Terminal:

Step 2: Cygwin Net Release setup program

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 3: Here we choose the source

Step 4: Select root to install directory

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 5: Select local package directory

Step 6: Here select your internet connection

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 7: Choose a downloaded site

Step 8: Select packages to install

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 9: Review and confirm changes

Step 10: Downloading

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 11: installation complete

Step 12: The cygwin was installed successfully.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

INSTALL ANSIBLE:
Step 13: Install Ansible in cygwin command prompt as pip install ansible

Step 14: Create Ansible roles Directory

Step 15: Using change directory command Create ansible roles

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 16: Organize the role Structure

Step 17: Write Tasks And Handlers

Step 18: Create Ansible Playbooks Directory

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Step 19: Open a notebook and type the program save it as my_playbook.yml

Step 20: Run the program and we get the output

Result:
Thus, installing ansible, configure ansible roles and to write playbooks done
successfully.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

[Link]: Create a CD pipeline in Jenkins and deploy in Cloud


Date:

Aim :
To create a Continuous Deployment (CD) pipeline using Jenkins for automating
the deployment of applications on a cloud platform, ensuring faster and reliable
delivery of updates.
Procedure :
Step 1: Set Up Jenkins
• Install Jenkins on a server or use a cloud-hosted Jenkins instance.
• Configure Jenkins by installing necessary plugins (e.g., Git, Pipeline,
Cloud-specific deployment plugins).
• Create a Jenkins user with appropriate permissions.
Step 2: Prepare the Cloud Environment
• Choose a cloud provider (e.g., AWS, Azure, GCP).
• Set up the infrastructure required for deployment (e.g., virtual machines,
Kubernetes clusters, or app services).
• Generate and securely store the cloud credentials (API keys, access
tokens).
Step 3: Create a Jenkins Pipeline
• Navigate to Jenkins and create a new pipeline project.
• Define the pipeline stages in a Jenkinsfile using the following typical
structure:
o Checkout Code: Pull code from the version control system (e.g.,
GitHub).
o Build: Compile and build the application (e.g., Maven, Gradle).
o Test: Run automated tests.
o Deploy: Deploy the application to the cloud environment.
Step 4: Write the Jenkinsfile

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

Example structure:
pipeline {
agent any
stages {
stage('Checkout Code') {
steps {
git branch: 'main', url: '[Link]
}
}
stage('Build') {
steps {
sh 'mvn clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
}
stage('Deploy') {
steps {
sh 'aws deploy push --application-name AppName --s3-location
s3://bucket-name/'
}
}
}
}
Step 5: Integrate Jenkins with Cloud

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

• Configure cloud provider plugins in Jenkins (e.g., AWS CLI, Azure


DevOps).
• Store the cloud credentials in Jenkins using the Credentials Manager.
• Test connectivity between Jenkins and the cloud environment.
Step 6 : Trigger and Monitor the Pipeline
• Start the pipeline manually or configure it to trigger on code commits or
schedule.
• Monitor each stage in the Jenkins dashboard for successful execution.
Step 7: Verify Deployment
• Access the deployed application in the cloud environment.
• Perform manual or automated tests to confirm the deployment was
successful.

Result :
The experiment successfully demonstrates the creation of a
Continuous Deployment pipeline using Jenkins and its integration
with a cloud platform.

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

[Link]: Create an Ansible playbook for a simple web application infrastructure

Date:

Aim :
To create an Ansible playbook for provisioning and configuring a basic web
application infrastructure, including a web server and database server, ensuring
consistency and automation in deployment.
Procedure :
Step 1: Set Up Ansible
• Install Ansible on a control node (e.g., Linux system).
• Configure SSH access to managed nodes (web server and database
server) by setting up passwordless authentication using SSH keys.
• Define the inventory file (hosts) to list the target nodes.
Step 2: Define the Infrastructure
• Decide the components of the infrastructure:
o A web server (e.g., Nginx or Apache).
o A database server (e.g., MySQL).
• Identify required software packages and configurations.
Step 3: Create an Inventory File
• Example hosts file:
[web]
[Link]

[db]
[Link]
Step 4: Write the Ansible Playbook
• Create a YAML file (e.g., web_app_playbook.yml).
• Example playbook:

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

- name: Set up a simple web application infrastructure


hosts: all
become: yes
tasks:
- name: Update the system
apt:
update_cache: yes
upgrade: dist

- name: Install web server


when: "'web' in group_names"
apt:
name: apache2
state: present

- name: Copy website files


when: "'web' in group_names"
copy:
src: /path/to/website/
dest: /var/www/html/
owner: www-data
group: www-data
mode: '0644'

- name: Install database server


when: "'db' in group_names"
apt:

Downloaded by Anusiya. T (anu13akshaya26@[Link])


lOMoARcPSD|35618914

-name: mysql-server
state: present

- name: Start services


service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- apache2
- mysql
Step 5:
Execute the Playbook
• Run the playbook using the following command:
bash
ansible-playbook -i hosts web_app_playbook.yml
Step 6: Verify the Infrastructure
• Check the web server by accessing the application in a browser using the
web server’s IP address.
• Verify the database server by logging into MySQL and ensuring it is
functional.
Step 7: Test and Validate
• Test the web application for functionality.
• Confirm the infrastructure meets the requirements and is consistent across
the nodes.
Result :
The Ansible playbook successfully provisions and configures a simple
web application infrastructure.

Downloaded by Anusiya. T (anu13akshaya26@[Link])

You might also like