Ansible Interview Questions and Answers

30+ TOP Ansible Interview Questions and Answers

Ansible Interview Questions
Ansible Interview Questions

1. What do you know about Ansible?
Ansible is the well-recognized open-source platform written and developed in Python language. This platform facilitates task automation, configuration management, and application deployment. It uses the SSH approach to deploy the application without any specific downtime.

2. Explain the use of Ansible?
automation is a crucial part of any software development process. The Ansible platform used in managing various IT infrastructure. It is also used for deploying software applications to remote nodes.

3. What are the major advantages of using Ansible?
Using Ansible can be beneficial in numerous ways. Then three of its advantages are mentioned below:
Very low overhead and easy to learn
Great performance
Consistent with security

4. Explain the Ansible Galaxy.
As Ansible facilitates bundling automation content. This makes it reusable. The Ansible galleries are needed here to share such Ansible roles. In simple words, the Ansible gallery is the tool which is merged with the Ansible. This integration creates the base directory structure.

5. What is continuous delivery in terms of Ansible?
It is the practice that involves delivering the software as soon as it is developed. For this, there is a need to use the versioning control system. Even in the live production system the software consistently updates.

6. How do Ansible works?
There are two main categories of server type in Ansible: the nodes and controlling machine. It simply uses the SSH protocol to deploy modules to nodes. These nodes stored in remote nodes interact with Ansible Machine. The Ansible has the capability to manage more than 100 nodes in one single system.

7. Name different modules in Ansible.
In Ansible there are two major types of modules: core modules and extra modules.

Core Modules: These modules are the first preference of the Ansible team. The core modules come with Ansible software.

Extra Modules: The extra modules are reusable but for some reason, they always get a lower rate of response to issues. These are also maintained and managed by the Ansible Community. Although the extra modules are merged with Ansible but one can use it separately in the future.

8. Explain the Ansible tower.
The Ansible is the web-based center which is used for all kind of automation tasks. There is no requirement to install the daemons to connect with other controlling machines as it is an agentless model. The Ansible tower allows you free usage till ten nodes.

9. What is the difference between Ansible and Puppet?
Ansible: The Ansible has the simplest technology written in the YAML language. It can be quickly installed and deployed because of agent-less architecture. The Ansible supports automated workflow for continuous delivery.

Puppet: The puppet has complex technology in comparison to Ansible. This is written in Ruby language. To access this, it is important to learn Puppet DSL.

10. Give a brief about Ansible architecture.
The Ansible is highly based on the agent-less architecture. This structure enables you to connect your nodes. The pool of modules can dwell on any system without any daemons, server or the database. The SSH protocol enables it to execute these modules. It removes them as soon as work is done.

11. What’s the difference between the environment variable and variable name?
The variable name can be created by adding stings. On the other hand, for the access of environment variable, there is a need to access the existing variables. The variable name uses ipv4 for the available name. For remote environment variables {{ ansible_env.SOME_VARIABLE }} is used.

12. What are the things Ansible can do?
With the Ansible these are the following things one can do:

Deployment of application
Configuration management
Task automation
IT orchestration

14. What language Ansible is written in?
The Ansible is written in PowerShell and Python programming language.

15. Can you please explain the meaning of the red hat Ansible?
The red hat Ansible and Ansible both all the great automation platforms. The end to end complete automation of these platforms makes it capable to provide below-mentioned functionalities:

Application deployment
Management and configuration of IT systems
Orchestrating workflows

16. What are the requirements of the Ansible server?
For the window users, there is a need for the virtual machine in which the Linux should be installed. Otherwise, the Ansible requires Python 2.6 version or the higher one.

17. Is it possible to create own modules with Ansible?
Yes, the Ansible allows us to create the modules within it. As it is an open-source tool that majorly runs on Python. This means anyone who has little bit knowledge of programming can create their own modules without any problem within Ansible.

18. What’s the best way to generate crypto passwords for the user module?
The availability of mkpassword utility in Linux is the best option for generating the crypto passwords. For the OS X users who don’t have this utility installed on your system, they can also generate crypto passwords by using Python.

19. Name the different components of Ansible.
Ansible automation is consist of the following elements:


20. How can we make content redistributable and reusable?
In Ansible there are three major ways to reuse files in playbooks which include import and roles.

21. Explain the way to access shell environment variables in Ansible.
For accessing shell environment variables in Ansible users need to use the “env” lookup plugin. There are some codes that you have to write for this. The codes are mentioned below:

_ _ _
# …
vars :

22. Is it possible to keep secret data in the playbook?
Yes, it is possible to keep secret data in your Ansible content with the use of Vault in playbooks. With V mode you have to use some commands to hide sensitive data from others.

23. Explain ad-hoc commands.
The ad-hocs are used to take action on the hosts without writing the playbooks. So, if you have to reboot the hosts in a specific group then there are two ways to do that. You can either create a new playbook or you can simply use the one-off ad-hoc command.

24. Explain the term “fact” in Ansible.
In the Ansible environment, “fact” is the most commonly addressed term. The facts are used by Ansible to get information about the host and store. The Ansible runs the setup modules to generate these facts.

25. What is the right way to copy files recursively onto a target host?
This “copy” module of Ansible has recursive parameters. You can also utilize “synchronize” modules if you need to perform more efficient for a huge number of files. It is important to use commands with “synchronize” modules.

26. Explain the meaning of Ansible tasks.
The Ansible tasks are majorly used to break up bits of configuration policy in little files. These small blocks of code that are used to automate any process.

27. Explain the Ansible role and what makes it different from the playbooks?
The Ansible role is completely another level of abstraction. These are used to organize playbooks. It provides an independent structure and a reusable collection of various things. It includes templates, files, variables, tasks, etc.

28. Why Ansible vaults are used?
The Ansible vaults are used to keep all your secret data safe. It facilitates the encryption of sensitive data but also integrates them into your playbooks. The files can either be entirely encrypted or unencrypted, the vault is implemented with file-level granularity. The Ansible vaults are very user-friendly.

29. Explain the features of the Ansible tower.
The Ansible towers display everything happening in the Ansible environment like inventory status, hosts and other recent activities. It also integrates the notifications about all the necessary updates. The multi-playbook workflow feature of Ansible tower makes it easier to chain all the playbooks. It is also useful for scheduling Ansible jobs.

30. How can you connect other devices within Ansible?
After installing Ansible on the controlling systems, one inventory file is created which particularly explains the connection between other nodes. The SSH protocol can be used to make a connection. If you want to check its connection, then you can use the ping module. The command to check this connection is: ansible -m ping all.

Frequently Asked Ansible Interview Questions