Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Interview Questions & Answers for Ansible

Ansible


Describe each of the following components in Ansible, including the relationship between them:

  • Task
  • Module
  • Play
  • Playbook
  • Role

How Ansible is different from other Automation tools?

True or False? Ansible follows the mutable infrastructure paradigm

True or False? Ansible uses declarative style to describe the expected end state

What kind of automation you wouldn’t do with Ansible and why?

What is an inventory file and how do you define one?

What is a dynamic inventory file? When you would use one?

How do you list all modules and how can you see details on a specific module?

Write a task to create the directory ‘/tmp/new_directory’

You want to run Ansible playbook only on specific minor version of your OS, how would you achieve that?

What the “become” directive used for in Ansible?

What are facts? How to see all the facts of a certain host?

What would be the result of the following play?

What would be the result of running the following task? How to fix it?

  • hosts: localhost tasks:
    • name: Install zlib
      package:
      name: zlib
      state: present

Which Ansible best practices are you familiar with?. Name at least three

Explain the directory layout of an Ansible role

What ‘blocks’ are used for in Ansible?

How do you handle errors in Ansible?

You would like to run a certain command if a task fails. How would you achieve that?

Write a playbook to install ‘zlib’ and ‘vim’ on all hosts if the file ‘/tmp/mario’ exists on the system.

Write a single task that verifies all the files in files_list variable exist on the host

Write a playbook to deploy the file ‘/tmp/system_info’ on all hosts except for controllers group, with the following content

The variable ‘whoami’ defined in the following places:

  • role defaults -> whoami: mario
  • extra vars (variables you pass to Ansible CLI with -e) -> whoami: toad
  • host facts -> whoami: luigi
  • inventory variables (doesn’t matter which type) -> whoami: browser

According to variable precedence, which one will be used?

For each of the following statements determine if it’s true or false:

  • A module is a collection of tasks
  • It’s better to use shell or command instead of a specific module
  • Host facts override play variables
  • A role might include the following: vars, meta, and handlers
  • Dynamic inventory is generated by extracting information from external sources
  • It’s a best practice to use indention of 2 spaces instead of 4
  • ‘notify’ used to trigger handlers
  • This “hosts: all:!controllers” means ‘run only on controllers group hosts

Explain the Diffrence between Forks and Serial & Throttle.

What is ansible-pull? How is it different from how ansible-playbook works?

What is Ansible Vault?

Demonstrate each of the following with Ansible:

  • Conditionals
  • Loops

What are filters? Do you have experience with writing filters?

Write a filter to capitalize a string

You would like to run a task only if previous task changed anything. How would you achieve that?

What are callback plugins? What can you achieve by using callback plugins?

What is Ansible Collections?

Ansible Testing

How do you test your Ansible based projects?

What is Molecule? How does it works?

You run Ansibe tests and you get “idempotence test failed”. What does it mean? Why idempotence is important?

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

Ansible Tower Install and Setup Quick Guide

To install Red Hat Ansible Tower 3.8.6 (using ansible-tower-setup-3.8.6-2.tar.gz), your environment must meet a set of hardware, software, and system prerequisites. Below are the summarized requirements specific to this Tower…

Read More

Ansible: How to use template in Ansible using Jinja2?

Here’s a comprehensive tutorial on Ansible Templates and Jinja2, suitable for engineers or anyone preparing for an advanced Ansible role. 1. What are Ansible Templates? Ansible templates…

Read More

Top 50 Azure DevOps interview questions and answers

1) What is DevOps? DevOps is Development and Operation’s Collaboration, it’s a Union of 3Ps – Process, People and Product (working Product) that enable continuous integration and…

Read More

What is Ansible and use cases of Ansible?

What is Ansible? Ansible is an open-source automation tool used for configuration management, application deployment, and task automation. It simplifies complex IT tasks by automating them using…

Read More

Top 50 Sonatype Nexus interview questions and answers

General Knowledge: Installation and Configuration: Artifact Management: Security and Access Control: Integration and Automation: Troubleshooting and Maintenance: Best Practices and Optimization: Sonatype Nexus is a repository manager…

Read More

Ansible Tutorials: Calling one Play & Tasks from another play in Playbook

import_tasks module The Ansible import_tasks module is used to import a list of tasks from a file into the current playbook for subsequent execution. The name of…

Read More