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.
The files which were stashed and saved to index and committed will be recovered back. Any untracked files will be lost.
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.
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
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.
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.
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.
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:
- name: Installing Git Application
And these tasks are reusable, and named as ansible roles and shared in Ansible Galaxy.
The main three advantages of Ansible are:
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
- name: Install yum package
|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.|
2023 Gamut Gurus Pvt Ltd, All rights Reserved.