You are on page 1of 3

AY:2022-2023 Sem: V

Class/Branch: TEIT Subject: DevOps Lab

Assignment-2

Lab Outcomes (LO):

ITL503.1: To explain fundamentals of DevOps practices which aims to simplify Software Development
Life Cycle
ITL503.2: Make use of various Git related operations to obtain complete knowledge of the "version
control system" to effectively track changes augmented with Git and GitHub
ITL503.3: To build and deploy Software Applications on server environment using Jenkins
ITL503.4: To build and test Software Applications using Selenium
ITL503.5: Analyze the Containerization of OS images and deployment of applications over Docker
ITL503.6: Make use of Ansible tool to implement software configuration management

*BL: Blooms Level *LO: Lab Outcomes

Q.1) Identify the process that can be used to integrate Selenium with Jenkins?CO:4 BL:3
Solution : There are a few ways to integrate Selenium with Jenkins.

Process 1: One way is to use the Selenium Jenkins plugin, which allows you to run Selenium tests as
part of a Jenkins build.

Process 2: Another way is to use a tool like Selenium Grid, which allows you to distribute your tests
across multiple machines, including Jenkins build servers.

Q.2) Compare the concept of virtualization in VMs with containerization in Docker? CO5, BL2
Solution :

Virtualization Containerization
This helps developers to run and host This helps developers to deploy multiple applications using
multiple OS on the hardware of a single the same operating system on a single virtual machine or
physical server. server.
Virtualization Containerization
Containers ensure isolated environment/ user spaces are
Hypervisors provide overall virtual machines provided for running the applications. Any changes done
to the guest operating systems. within the container do not reflect on the host or other
containers of the same host.
These virtual machines form an abstraction of
the system hardware layer this means that Containers form abstraction of the application layer which
each virtual machine on the host acts like a means that each container constitutes a different application.
physical machine.

Q.3) Make use of docker for multiple application environments?CO:5 BL:3


Solution : Docker-compose feature of docker will come to help here. In the docker-compose file, we
can define multiple services, networks, and containers along with the volume mapping in a clean
manner, and then we can just call the command “docker-compose up”.
When there are multiple environments involved - it can be either dev, staging, uat, or production
servers, we would want to define the server-specific dependencies and processes for running the
application. In this case, we can go ahead with creating environment-specific docker-compose files of
the name “docker-compose.{environment}.yml” and then based on the environment, we can set up
and run the application

Q.4) Make use of commands in Ansible to automate the password input in playbook using
encrypted files?CO:6 BL:3
Solution:

To automate password input we can have a password file for all the passwords of encrypted files will
be saved and ansible can make a call to fetch those when required.
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q
user@gateway.example.com"'

This can also be achieved by having a separate script that specifies the passwords. But in this case,
we need to print a password to stdout to work without annoying errors.
ansible-playbook launch.yml --vault-password-file ~/ .vault_pass.py

Q.5) Configure and Install Nginx using Ansible playbook? CO:6 BL:3
Solution: The playbook file would be:
- hosts: stagingwebservers
gather_facts: False
vars:
- server_port: 8080
tasks:
- name: install nginx
apt: pkg=nginx state=installed update_cache=true
- name: serve nginx config
template: src=../files/flask.conf dest=/etc/nginx/conf.d/
notify:
- restart nginx
handlers:
- name: restart nginx
service: name=nginx state=restarted
- name: restart flask app
service: name=flask-demo state=restarted

In the above playbook, we are fetching all hosts of stagingwebservers group for executing these tasks.
The first task is to install Nginx and then configure it. We are also taking a flask server for reference.
In the end, we also defined handlers so that in case the state changes it will restart Nginx. After
executing the above playbook we can verify whether Nginx is installed or not
ps waux | grep nginx

You might also like