Ansible interview questions For Freshers & Experienced

  • Question 1) Explain what is ansible?
  • Question 2) What is Ansible Galaxy?
  • Question 3) What is Ansible Task?
  • Question 4) What is Ansible Tower?
  • Question 5) What are Ansible vaults?
  • Question 6) What is ansible-playbook?
  • Question 7) What is cowsay in ansible?
  • Question 8) What is CI/CD in ansible?
  • Question 9) What is inventory in ansible?
  • Question 10) Enlist some important modules of ansible?
  • Question 11) What are Ad-hoc commands in ansible?
  • Question 12) What is use of ask_pass module in Ansible?
  • Question 13) What is Callback_plugin in Ansible?
  • Sharad Jaiswal
  • 12th Dec, 2019

Ansible is an open-source automation engine for automating IT infrastructures, application deployment, and many other tools. Since it was released in 2012, it doesn't have a large community to support. But it is constantly growing at a vast pace and competing with the older engines. Like others, it has many features such as easily deployment due to Agentless functionality, uses playbooks to describe Automation tools, use of YAML language which is very easy to understand and many more.

It is not possible to describe all about Ansible here. So, give time to yourself to read the full article and know more about it in a detailed manner. Along with that, you will find online interview questions on Ansible that will help you to crack any interviews.

Ansible interview questions
Updated ON

12th Dec, 2019

No. of Questions


Posted In



Sharad Jaiswal

Key Features of Ansible

Below are few major features of Ansible

Easy to Learn

‎GNU General Public License

YAML-Based configuration


Dynamic Inventory script

REST API and web service

Multiple Platform support

Cloud integration

Secure and Highly reliable

Ansible Interview Questions

Q1. Explain what is ansible?

Ansible is a simple IT automation platform that is used to make your application easy to deploy. It presents a custom code to deploy and update your application. It can be described as provisioning, configuration, and application-deployment tool. This open-source tool can be used to configure both the UNIX and Windows systems. Written in Python, Ruby, Powershell, Ruby,

Ansible was developed by Michael Dehaan and was acquired by Red Hat in 2015.

Q2. What is Ansible Galaxy?

Ansible Galaxy command is used to perform various role and collection related operations. It is a command that is used to manage Ansible roles in the shared repositories.

ansible-galaxy [-h] [--version] [-v] TYPE …

Here, --version is the program’s version number, -h shows the help message, -v makes it to the verbose mode.

Q3. What is Ansible Task?

Ansible calls task is used to represent well-defined roles. On a basic level, a task is just a call to an ansible module.

Q4. What is Ansible Tower?

Ansible Tower is used to centralize and control the IT infrastructure. It presents a visual dashboard, job scheduling, integrated notifications, role-based access control, and graphical inventory management to control your IT infrastructure. It can be easily embedded into your tools using REST API and CLI.

The dashboard in the Ansible tower gives a NOC-style notification for everything that is been going on in the Ansible environment.

Q5. What are Ansible vaults?

As the name suggests, Ansible vault is used to store your sensitive data such as passwords or keys as an encrypted file rather than as a plaintext. This sensitive vault is then distributed. To enable the ansible vault, -ansible-vault command-line tool is used. It is used to create, edit, encrypt, decrypt, and view the sensitive files. It can be used to encrypt a file with File-level encryption or just a single value using variable-level encryption.

Q6. What is ansible-playbook?

The playbook in Ansible is used to describe something that you want to enforce or set in a general IT process. It is a configuration, deployment, and orchestration language. It is designed to be human-readable as it is developed in a basic text language.

Using a playbook, you can declare configurations, launch tasks synchronous or asynchronously, and orchestrate steps in a process. They have minimum syntax as Playbook is expressed in YAML language.

Q7. What is cowsay in ansible?

Cowsay in Ansible is used to generate ASCII pictures of a cow with a message. It is enabled in Ansible by default and you can disable this kind of output by setting ANSIBLE_NOCOWS = 1.

There are other ASCII drawings available apart from the cow, to use these drawings randomly, set ANSIBLE_COW_SELECTION=random.

Q8. What is CI/CD in ansible?

CI (Continuous Integration) and CD (Continuous Development) process can be used in the Ansible as it is a powerful IT automation tool.

Ansible is used to create all the infrastructure for the provision of the application and Jenkins is used to orchestrate the CI/CD pipeline flow.

Q9. What is inventory in ansible?

Ansible inventory is a command that is used to display the configured inventory.


ansible-inventory Different options are used with this command to configure the inventory.

Such as:-  --export, --graph, --host, --list, --list-hosts, --toml, --vars, --vault-id, --version, --help, --inventory, --linit, --verbose, --yaml.

Q10. Enlist some important modules of ansible?

Some of the important modules in the Ansible are,

  • Ping Module - It is used to check the connection with the hosts. It checks whether the connection is defined in the inventory file is established or not.
  • Setup Module - It is used to see the information of all the hosts, their configuration and detailed information.
  • Copy Module - It is used to copy a file from the remote server to the destination nodes in playbooks.
  • Yum Module - It is used to install a service.
  • Shell Module - It is used to run UNIX commands.
  • Service Module - It is used to ensure the state of the service.
  • Debug Module - It is used to print msg on hosts.
  • Template Module - It is used to copy a configuration file from the local system to the host server.
  • Include Module - It is used to include other playbooks in our playbook.
  • User Module - It is used to add a particular user to our module.

Q11. What are Ad-hoc commands in ansible?

Ad-hoc commands are the one line Ansible command that is used to perform just one task on the target host. With this, you can execute a simple one-line task against one host or a group of hosts. It requires two parameters to run. The first parameter defines the group of a host and the second parameter defines the Ansible module to run.

ansible all -m ping

The above command runs the ping module on all the hosts in the inventory file.

Q12. What is use of ask_pass module in Ansible?

The ask-pass in ansible-playbook command is an option that is used to ask for the connection password.

ansible-playbook --ask-pass

Q13. What is Callback_plugin in Ansible?

A callback plugin is used to add new behaviors to Ansible. It adds the behavior when responding to the events. Callback plugin control most of the output that you see when running the command line programs. It can also be used to add additional output, integrate with other tools, and marshall the events to the storage backend.

You can activate the callback plugin by either dropping the custom callback plugin into the callback plugins directory or by putting it in the callback directory sources that are configured in the ansible.cfg. You can set the call back plugin for the ansible-playbook and the ad-hoc commands.

Q14. In which language Ansible is written?

The Ansible is written in Python, Powershell, and Ruby.

Q15. What is difference between ansible plugins and modules?

The difference between the Ansible plugins and the modules are,

  1. Modules in the Ansible are reusable scripts that are used by the Ansible API, Ansible command, or the Ansible playbook. It provides a defined interface to accept the arguments and returns the information to Ansible by printing a JSON string. Modules usually execute on the remote target system in separate processes.
  2. Plugins are used to augment Ansible’s core functionality. It executes on the control node within the ansible process. Plugins offer different options and extensions for different core features such as Ansible transforming data, logging output, connecting to the inventory, and more. Plugins can be loaded automatically by loading plugin separately from a directory name of the plugin. Some of the plugin directory names are action_plugins, cache_plugins, filter_plugins, etc.

Ansible vs Puppet. Which is better?

Ansible Puppet
Ansible was introduced in 2012 by Ansible Works which is currently owned by the Red Hat. The Puppet was introduced in 2005 and founded by the Luke Kanies.
It is written in the Python programming language. It is written in the Ruby programming language.
It is meant to be lightweight with fast deployment features. Puppet is so slow in adopting requested changes like new features additions or fixing bugs etc.
Ansible’s repository name is Ansible Galaxy. Puppet’s repository name is Puppet Forge.
In Ansible, the server pushes configurations to nodes for quick deployment. The client pulls configurations from the server in case of the puppet.
Scalability is considered more convenient in Ansible. Scalability is considered less convenient in Puppet
Ansible has a smaller developer community than Puppet Puppet has more support and a bigger developer community.
Ansible is good for small and easy deployments Puppet is generally used for complex or longer deployments.

Pros of Ansible:

  • Easy to understand: The most important feature of any automation tool is its understanding. This means how easily the user can understand it and how much throughput it can provide in a short amount of time. Well, good news for all Ansible users, it provides both features with great speed and perfection. There is no dependency system in Ansible which let the tasks run sequentially and when an error encounter, it stops.  Besides, this also makes troubleshooting easier.
  • Ansible Galaxy: Unlike others, Ansible has the feature named as Galaxy. This is the central repository for searching and sharing the Ansible content. It can be also used for reusing, for example, roles for server configuration can be downloaded and reused by many users. This also accelerates the deployment time. 
  • Python-based: Contrary to other competing solutions which are written in languages such as Ruby, Ansible is written in Python. This results in an easily understandable, flexible and faster in speed as most python libraries are present by default. Coupling with this, Python is a common language for scripting and all engineers and administrators are most likely to know Python. So, they don’t face the difficulty to learn a new language for using Ansible.
  • Extensible: In conjunction with the above all, Ansible modules are popular for extending the functionality of their tools. They can be written in any language means they are not language constraint, but as long as Ansible returns data in JSON format.
  • Documentation: It has great documentation in which all the functionalities, features are explained in a very detailed manner. Any native user can learn Ansible from its documentation very easily. 
  • No need of Agents:  Ansible doesn't need agents to be installed on its system to manage the nodes. However, it handles all agent-master communications with Paramiko module or standard SSH. Being agentless, it doesn't have to maintain the agents, so less burden and better performance.
  • Playbooks are written in YAML: Ansible configuration files also known as Playbooks are written in YAML. It is better than other formats such as JSON for configuration and automation purposes. It supports comments which make its code more readable. Along with that, it also uses the anchors for referencing other things.

Cons of Ansible:

  • Popularity: It is not as much popular as Chef or Puppet because it is newer in the market. It doesn't have a large community to support the users, and also there is less information available on the web. So, the person who wants to use Ansible has to face difficulty to find the solutions to their problems. 
  • Less support of Enterprise: As it is newer in the market, therefore it doesn't have much experience working with large enterprises. 
  • Lack of UI: Ansible support Ui with AWX, a graphical user interface to manage infrastructure easily. But is it capable enough to compete with the command line interface? The answer is no. AWX finally evolved into Ansible Tower but still, its work is in progress. It can't match the functionality of Command-line Interface and only 85% work of CLI can be performed by GUI.
  • No notion of state: Since it doesn’t keep track of dependencies so performs the sequential series of tasks. It is beneficial for some users, but many like to go with the automation tool to manage the extensive catalogs for ordering. So, I think, this depends on a user to user.

About Author :

  • Author of Ansible interview questions

    Sharad Jaiswal

    Sharad Jaiswal is Sr. Web Developer from Noida area. He have rich experience in PHP, Angular Js, React, javascript and Node .If you any query or project on these programming you can drop your enquiry in comment section.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.