Please enable JavaScript to view the comments powered by Disqus. Most Ask 20 Ansible Interview Questions & Answers 2021[Updated]

 

 

 

 

Top 20 Ansible Interview Questions For 2021

NovelVista
NovelVista

Last updated 20/07/2021


Top 20 Ansible Interview Questions For 2021

What is the one tool that can be handle configuration management, task automation, and application deployment altogether, yet smoothly?

What else can it be other than Ansible?

Developed by Michael DeHaan, the author of the provisioning server application Cobbler and co-author of the Fedora Unified Network Controller (Func) framework for remote administration, Ansible is the DevOps tool that can set your DevOps culture up to its own tune.

Initially, Ansible, Inc. was the company set up to commercially support and sponsor Ansible. In October 2015, Red Hat came forward and acquired Ansible.

Ansible is included as part of the Fedora distribution of Linux, owned by Red Hat, and is also available for Red Hat Enterprise Linux, CentOS, OpenSUSE, SUSE Linux Enterprise, Debian, Ubuntu, Scientific Linux, and Oracle Linux via Extra Packages for Enterprise Linux (EPEL), as well as for other operating systems.

Now, with this amazing adaptability with such a long list of operating systems, who wouldn’t love to work on Ansible?

That’s right, there are no organizations like this. Hence, when you appear for your DevOps interview, Ansible becomes one of the favorite topics of your interviewer.

Hence, we searched and found out a list of the

Most Asked 20 Ansible Questions & Answers for Beginner & experienced

for your next interview. Have a look!

1.  What is Ansible?

It is an open-source platform that advocates configuration management, task automation, or application deployment. Written in Python and powered by Red Hat, it is quite important DevOps tool. It deploys SSH with the help of SSH, without suffering from any downtime.

2. What are Ansible’s advantages?

Ansible’s advantages are as follows:

  • It’s agent independent and only requires SSH service running on the target machines
  • The only dependency of Ansible is Python and luckily, most systems come with the language pre-installed
  • It requires minimal resources, hence it’s pretty much cost-effective
  •  Ansible tasks are written in YAML, so it’s user friendly
  • Whereas the other tools are mostly procedural, Ansible is declarative; define the desired state, and Ansible fulfills the requirements needed to achieve it

3. What are CD and CI, and what is Ansible’s relationship with them?

CD stands for continuous delivery, and CI stands for continuous integration. Both of them are very known for software development practices. 

In CD, developers take care of the release of their software products in the condition of releasing it for production at any given time. CI is responsible for each developer uploading regularly scheduled integrations (usually daily), resulting in multiple integrations every day. Ansible is an ideal tool for CI/CD processes, providing a stable infrastructure for provisioning the target environment and then deploying the application to it.

4. State the requirements for the Ansible server.

The requirements of Ansible server are as follows:

  • Virtual machine with Linux installed on it
  • Python version 2.6 or higher.

5. Explain what a “playbook” is.

A playbook is a collection of YAML-based files that forward commands to remote computers with the help of scripts. Developers can configure the whole complex environments by forwarding a script to the demanded systems rather than using different commands to configure computers from the command line remotely. Playbooks are Ansible’s strongest market points and often known as the tool’s building blocks.

6. How do you set up Ansible?

You can use the Python installer to set up Ansible. Also, a Linux-based installation process, such as apt or yum can work as well.

7. What is Ansible Galaxy?

Ansible Galaxy is a tool adjoint to Ansible to create a base directory structure. Galaxy is basically a website that allows users to find and share Ansible content. You can use the following command to download roles from the website:

$ ansible-galaxy install username.role_name

8. How do you use Ansible to create encrypted files?

To create an encrypted file, you need to use the following command.

$ ansible-vault create filename.yaml

After putting this, you will get a prompt to create a password. After creating a password, you’ll have to type it again for confirmation. You will now have access to a new file, where you can add and edit data.

9. What are “facts” in the context of Ansible?

Facts are newly recognized and acknowledged system variables of the playbooks. They are used mostly for implementing conditionals executions. They also gather ad-hoc system information.

You can get the facts by using this command:

$ ansible all- m setup

10. Explain what an ask_pass module is.

Ask_pass module is a playbook control module that is used to control a password prompt. It is always set to True by default.

11. What’s an ad hoc command?

Ad hoc commands are used to initiate actions on a host without using a playbook. It is basically a one-shot command.

12. Explain the difference between a playbook and a play.

A play is basically a set of tasks that can run on multiple managed hosts. Plays are made of one or more tasks. On the other hand, the playbook consists of one or more plays.

13. What exactly is a configuration management tool?

Configuration management tools help in keeping a system running within the desired parameters. They help in reducing the deployment time and substantially reduce the effort required to perform repetitive tasks. Popular configuration management tools on the market today include Chef, Puppet, Salt, and of course, Ansible.

Finally, let us go through the Ansible interview questions at an advanced level.

14. What are tags?

When there’s an extensive playbook involved, sometimes it’s more expedient to run just a part of it as opposed to the entire thing. That’s what tags are for.

15. Speaking of tags, how do you filter out tasks?

You can filter out tasks in one of two ways:

  • Use –tags or –skip-tags options on the command line
  • If you’re in Ansible configuration settings, use the TAGS_RUN and TAGS_SKIP options.

16. What’s a handler?

In Ansible, a handler is similar to a regular task in a playbook, but it will only run if a task alerts the handler. Handlers are automatically loaded by roles/<role_name>/handlers/main.yaml. Handlers will run once, after all of the tasks are completed in a particular play.

17. How do you upgrade Ansible?

Upgrading Ansible is easy. Just use this command: sudo pip install ansible==<version-number>

18. When do you use {{ }}?

One of Ansible’s most basic rules is: “Always use {{ }} except when:”

19. Explain how to access shell environment variables.

You can access the controlling machine’s existing variables by using the “env” lookup plugin. For instance, to access the value of the management machine’s home environment variable, you’d enter:

local_home:”{{lookup(‘env’,’HOME’)}}”

20. What is “idempotency”?

idempotency is an important Ansible feature. It prevents unnecessary changes in the managed hosts. With idempotency, you can execute one or more tasks on a server as many times as you need to, but it won’t change anything that’s already been modified and is working correctly. To put it in basic terms, the only changes added are the ones needed and not already in place.

Conclusion:

Still, thinking of skipping Ansible? Well, do it at your own risk then, since it’s just a trailer. To pursue a full-on DevOps character, you need to have hands-on practice of Ansible as well. Wonder how you can acquire that? Join Our DevOps training sessions and let the experts teach you!

Topic Related Post
Top HR Round Interview Questions with Answers 2023
Top 25 Project Management Interview Questions & Answers
Top 25 Frequently Asked Scrum Master Interview Questions for 2023

About Author

NovelVista Learning Solutions is a professionally managed training organization with specialization in certification courses. The core management team consists of highly qualified professionals with vast industry experience. NovelVista is an Accredited Training Organization (ATO) to conduct all levels of ITIL Courses. We also conduct training on DevOps, AWS Solution Architect associate, Prince2, MSP, CSM, Cloud Computing, Apache Hadoop, Six Sigma, ISO 20000/27000 & Agile Methodologies.

 
 
SUBMIT ENQUIRY

* Your personal details are for internal use only and will remain confidential.

 
 
 
 
 
 
Upcoming Events
ITIL-Logo-BL ITIL

Every Weekend

AWS-Logo-BL AWS

Every Weekend

Dev-Ops-Logo-BL DevOps

Every Weekend

Prince2-Logo-BL PRINCE2

Every Weekend

Topic Related
Take Simple Quiz and Get Discount Upto 50%
Popular Certifications
AWS Solution Architect Associates
SIAM Professional Training & Certification
ITIL® 4 Foundation Certification
DevOps Foundation By DOI
Certified DevOps Developer
PRINCE2® Foundation & Practitioner
ITIL® 4 Managing Professional Course
Certified DevOps Engineer
DevOps Practitioner + Agile Scrum Master
ISO Lead Auditor Combo Certification
Microsoft Azure Administrator AZ-104
Digital Transformation Officer
Certified Full Stack Data Scientist
Microsoft Azure DevOps Engineer
OCM Foundation
SRE Practitioner
Professional Scrum Product Owner II (PSPO II) Certification
Certified Associate in Project Management (CAPM)
Practitioner Certified In Business Analysis
Certified Blockchain Professional Program
Certified Cyber Security Foundation
Post Graduate Program in Project Management
Certified Data Science Professional
Certified PMO Professional
AWS Certified Cloud Practitioner (CLF-C01)
Certified Scrum Product Owners
Professional Scrum Product Owner-II
Professional Scrum Product Owner (PSPO) Training-I
GSDC Agile Scrum Master
ITIL® 4 Certification Scheme
Agile Project Management
FinOps Certified Practitioner certification
ITSM Foundation: ISO/IEC 20000:2011
Certified Design Thinking Professional
Certified Data Science Professional Certification
Generative AI Certification
Generative AI in Software Development
Generative AI in Business
Generative AI in Cybersecurity
Generative AI for HR and L&D
Generative AI in Finance and Banking
Generative AI in Marketing
Generative AI in Retail
Generative AI in Risk & Compliance
ISO 27001 Certification & Training in the Philippines
Generative AI in Project Management
Prompt Engineering Certification
Devsecops Practitioner Certification
AIOPS Foundation Certification
ISO 9001:2015 Lead Auditor Training and Certification
ITIL4 Specialist Monitor Support and Fulfil Certification
Generative AI webinar
Leadership Excellence Webinar
Certificate Of Global Leadership Excellence
ISO 27701 Lead Auditor Certification
Gen AI for Project Management Webinar
Certified Cloud Tester Foundation
HR Business Partner Certification
Chief Learning Officer Certification
Gen AI in Cybersecurity Webinar
Six Sigma Webinar
Gen AI Powered ITSM Webinar
PM Prince2 PMP Webinar
Certified Generative AI Expert
GCP Professional Cloud Architect
GitHub Copilot Training Program
Certified Service Desk Professional
Certified Generative AI in ITSM
Recruitment & Sourcing