Menu ×

Interview Preparation Guide

Most Asked DevOps Interview Questions

Here we have compiled the most probable DevOps interview questions asked in the industry. You will learn about software version control, Git repository, reverting a commit in Git, Vagrant, continuous testing elements, and the importance of continuous integration, testing, and deployment. These questions are curated after discussing with many interviewers and DevOps Training experts.

DevOps Tools

Git
Maven
Jenkins
Docker
Ansible
Terraform
Kubernetes
Tomcat
linux
Interview Questions
Showing 51 - 60 of 325 results
51. What work is restored when the deleted branch is recovered?

The files which were stashed and saved to index and committed will be recovered back. Any untracked files will be lost.

52. How do you find a list of files that have changed in a particular commit?

git diff-tree --no-commit-id --name-only -r
Here –no-commit-id will hide the commit ids from listing in the output, and –name-only will only list the file names, instead of their full paths.

53. How to undo or revert the last commit?

View commit history using the "git log" command. Now you are at HEAD (latest commit).
You need to check out the previous working commit. For this you have to "git checkout ".
Now you should be at detached HEAD and you can undo the last commit using "git revert ".
Then make sure that your head should always be at latest, so do "git checkout ". That's it.

54. Tell me the difference between HEAD, working tree and index, in Git?

The HEAD always points to the last commit in your current branch.
The working tree is the workspace or working directory, where you write/add/edit the code.
The index is also known as staging area. which stores your works of working tree in it with the user details, SHA Id, timestamps, and the file name. It is not another directory and does not contain a copy of files in it. Now if you commit the files/directories which are in the staging area are moved to your local repository.

55. What is an Ansible?

Ansible is an open-source software, powerful and agentless automation platform. It is used while deploying an application using ssh with zero downtime. It is also used in Configuration management, Cloud Provisioning, Application Deployment, Intra-Service Orchestration easily. It runs on many Unix-like systems, and can manage configurations of both Unix-like systems as well as Windows systems. And YAML is its declarative script. It is developed in Ruby, Python and PowerShell languages by Michael DeHaan and acquired by Red Hat in 2015.

56. What is configuration management?

Managing configurations of the project like in IT-Infrastructure identifying the configuration, controlling configuration and configuration audit. So this is like a practice of managing and automating all the configurations required for the applications, so that the application can run seamlessly on readily tuned infrastructure. And this reduces the product release time as well.

57. What is an Ansible Task?

Ansible Tasks are small blocks of code in the playbook that can be used to execute any job. For example, if you want to install a package or update a software, you can follow the below code notation, it is a single task to install git software:

tasks:
    - name: Installing Git Application
      yum: git
      state: present

And these tasks are reusable, and named as ansible roles and shared in Ansible Galaxy.

58. What are the advantages of using Ansible?

The main three advantages of Ansible are:

  • Agentless: Ansible is fast and performs all functions over SSH and doesn't require agent installation. As long as the machine has ssh and python installed.
  • Very Simple: Has very simple architecture, simple installation and easily manageable.
  • Idempotent: Architecture of Ansible is structured around the concept of idempotency. Means the things which you do on a daily basis regularly, can be automated.
  • Declarative: No procedural approach, Ansible is declarative, needs to be defined at a high level in Yaml and Ansible makes the things done.
  • Ansible Modules: Ansible has so many built in modules, which gives Ansible more power to execute various variety of tasks.
  • Ansible Galaxy: A website where Ansible users share their customized roles to make it reusable.

59. What is ansible-playbook?

The Ansible Playbooks contains details of remote hosts, user variables, tasks, handlers in it. Playbook may have one or more tasks and these tasks are executed by Ansible. Usually playbooks are .yaml files. Here is a sample playbook:
---
  - name: Install Git
    hosts: linux
    gather_facts: false
    become: true
    vars:
         version: 2.19.1
    tasks:
       - name: Install yum package
         yum: git
         state: present

60. Ansible Playbooks vs Roles?

RolesPlaybooks
Roles are reusable subsets of a Play.Playbooks may contain one or more Plays.
A Role is a set of tasks to be done.Defines hosts, where roles should be executed. As it knows inventory.
AExample: general, git.Example: site.yml, myplay.yml.

Icon Stack with Contact Form
Contact us