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 Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

TFS Interview Questions and Answers: Practical DevOps Guide

A structured, interview-focused guide to Team Foundation Server (TFS), including TFVC vs Git, build and reporting topics, and practical command examples. Use it to prepare concise, technically strong answers for common TFS interview scenarios.

Read More

Chef Interview Q&A (Part 2): Resources, Run-Lists, Bootstrap, and Test Kitchen

A practical rewrite of classic Chef interview questions, focused on how Chef resources converge, how run-lists drive node configuration, and how to test cookbooks safely. Includes command examples, workflow diagrams, and comparison tables.

Read More

Chef Interview Questions, Explained: Resources, Run-Lists, Bootstrapping, and Test Kitchen

This updated guide converts classic Chef interview Q&A into a practical reference for real infrastructure work. It covers core concepts, execution order, bootstrap flow, key knife commands, and Test Kitchen testing patterns.

Read More

SVN Interview Questions and Answers: Trunk, Branch, Tag, Update, Commit, Patch, Backup, and Authentication

A practical, interview-focused guide to Subversion (SVN) concepts and commands. Learn how to explain trunk/branch/tag, update vs commit, conflict handling, patching, backup/restore, and auth setup with confidence.

Read More

Jenkins Interview Questions, Answered: CI, APIs, Installation, Backups, and Essential Plugins

This revised guide turns common Jenkins interview prompts into practical answers you can explain with confidence. It covers CI fundamentals, API usage, setup on Ubuntu and RHEL-like systems, backup strategy, and key plugins.

Read More

Git, GitHub, and GitLab Interview Questions: Practical Answers and Command Guide

A practical interview-prep guide covering core Git concepts, essential commands, and common GitHub/GitLab questions. Includes workflow diagrams, comparisons, and troubleshooting checklists.

Read More