Top 20 Ansible Interview Questions and Answers for Freshers, Experienced


If you are looking for Ansible interview questions for freshers and experienced then you are at the right place today. There are a lot of opportunities from the most reputed companies worldwide for the post of Ansible professionals. Based on the research, Ansible has a good market share of up to 5 percent or more. So, you have the opportunity of moving ahead as an Ansible professional and get your dream job immediately. JanBask Training gives you a complete list of advanced Ansible Interview questions to crack your interview in 2019 and acquire the position of Ansible analyst with some reputed companies.

Ansible Interview Questions

  • What is Ansible?
  • List the main advantages of AnsibleDevOps tool.
  • Explain the working of Ansible.
  • What are the major applications of Ansible tool in IT industries?
  • How can you submit the changes to the documentation?
  • What is the installation process for Ansible?
  • How can you create encrypted passwords for the user module?
  • How to make any content reusable or redistributable?
  • How can you check either all inventory vars defining the host?
  • How to copy a file recursively on to a target host?
  • What do you mean by the term Role in Ansible?
  • How will you differentiate the environment variables and simple variables in Ansible?
  • What are the best techniques for content reuse or redistribution?
  • How will you differentiate Ansible playbooks and Roles?
  • How will differentiate the Ansible from Puppet?
  • Tell about your software Company and how did you use the tool there?
  • Describe something about the Ansible Newsletter.
  • Is there any web interface or Rest API for the Ansible tool?
  • What is the process for accessing shell environmental variables?
  • How to speed up management within EC2 instance?

Top Ansible Interview Questions Answer for Freshers

Q1). What is Ansible?

Ansible is a popular software tool that is used to deploy apps with SSH without any downtime. It can also be used to manage or configure apps and Ansible is developed with Python language.

Q2). List the main advantages of AnsibleDevOps tool.

The major advantages of the AnsibleDevOps tool include – Agentless, excellent performance, and low overhead etc.

  • We don’t need an agent to set up the Ansible. If the system can support the SSH command or Python then you can set up Ansible within minutes.
  • Ansible has structured architecture so you could ass necessary things only that are actually required and delete repeated things that are not required.
  • It is quite easy to learn and declarative in nature.

Q3). Explain the working of Ansible.

Ansible is categorized into two major modules – controlling machines and nodes. Ansible is installed over the controlling machine and nodes are also managed with the help of this controlling machine over SSH. Further with the help of SSH protocol, ansible deploys modules over the nodes that are stored temporarily over there. With a standard JSON connection, Ansible will communicate the standard output too.

There is no need for installing any agent because this is an agentless machine and there are no background daemons that are executing for the Ansible. This tool has the capability to manage 100 of nodes together from a single SSH connection and you need to use multiple commands ahead for the deployment.

Q4). What are the major applications of Ansible tool in IT industries?

Ansible in IT infrastructure is used to manage or deploy software apps over the remote nodes. For example, if you wanted to deploy a software application over 100 of nodes together by using a single command only then the role of Ansible comes into existence here. Ansible allows you to deploy as many apps as possible over the nodes with a single command and you don’t need any programming background for the same.

Q5). How can you submit the changes to the documentation?

Documentation is stored within the GIT repository in Ansible and you can access the docs and submit the changes at the same place.

Q6). What is the installation process for Ansible?

To install ansible, you need to first install a software package called “Python software properties” with the command as given below –

Sudo apt-get update

Sudo apt-get install software-properties-common

Once the package is installed successfully, we can add the Ansible to the system with the following command –

Sudo apt-add-repository ppa:ansible/ansible

Now just refresh your system and you can use Ansible for software applications ahead.

Q7). How can you create encrypted passwords for the user module?

In the case of Linux systems, there is one mkpasswd utility is available to generate encrypted passwords with the command given below –

Mkpasswd –method=sha-512

In case, this utility is not installed on to your system then you can generate with one more technique too i.e. python as shown below.

Pin install passlib

Q8). How to make any content reusable or redistributable?

If you don’t know how to do it already then read the rules of playbook thoroughly, it will help you in knowing how to reuse or share the content with others. If there is some plugin that looks strange to you then check out API documentation for more details and know how Ansible can be extended.

Q9). How can you check either all inventory vars defining the host?

Yes, there is one specific command to check either all inventory vars defining the host or not.

Ansible –m debug –a “var=hostvars[‘hostname’]” localhost

Q10). How to copy a file recursively on to a target host?

The copy module has one recursive parameter and if you want to do something more efficient here then use the synchronized module here.

Top Ansible Interview Questions Answers for Experienced

Q11). What do you mean by the term Role in Ansible?

To create an Ansible role, you should first work on the directory structure. For this purpose, we are using Ansible galaxy command as shown below –

$ ansible-galaxy init azavea.packer

Azavea.packer was created successfully

Q12). How will you differentiate the environment variables and simple variables in Ansible? 

Variable Name –

  • You could build a variable name with the help of strings.
  • You can add strings.
  • For variable names, we need IPv4 addresses.

Environment Variables –

  • To access any environment variable, you should access the existing variable first.
  • If you wanted to set variables then check out the advanced playbook section.
  • For environment variables, we need to use a different command other than IPv4.

Q13). What are the best techniques for content reuse or redistribution?

The best techniques for content reuse or redistribution includes – Include, Imports, and Roles. Here, Imports and Include are used to break small files of a massive playbook while roles are used to manage multiple tasks within a package including handlers.

Q14). How will you differentiate Ansible playbooks and Roles?

Ansible playbook is a simple deployment and configuration management system. When compared to other, it is quite suitable for the deployment of complex apps. Further, Ansible Roles are automatically loaded and based on a known file structure. It makes sharing of roles easy with other users.

Q15). How will differentiate the Ansible from Puppet?

Ansible and puppet both are popular DevOps tools and you can prefer one over other based on requirements. Here are some logical differences to help you in deciding the best out of the two.

Ansible

  • The tool has excellent performance, agentless installation, and the deployment.
  • Ansible is based on Python programming language completely.
  • The common line interface accepts commands in all possible languages.
  • GUI is average and it gives good support for Windows.

Puppet –

  • The performance is little problematic when compared to Ansible and this is an agent-based install.
  • Puppetis based on RUBY programming language completely.
  • You should learn Puppet DSL language to work with this tool.
  • The GUI is amazing and it gives support to all major operating systems.

Q16). Tell about your software Company and how did you use the tool there?

Well, this is again a simple question whose answer varies from person to person. Here, you need to explain about your Company first then explain the working of the tool and the logic behind it how to use it effectively.

Q17). Describe something about the Ansible Newsletter.

Here you need to list all important activities related to the tool that you are going to complete in the recent timeframe. Here, you can set reminders, or timeframes to complete a particular task and start with the next immediately. Most of the concepts related to Ansible are available online too because this is just an amazing tool and accepted worldwide by organizations.

Q18). Is there any web interface or Rest API for the Ansible tool?

Yes, Ansible is just an amazing tool and easy to use as well.

Q19). What is the process for accessing shell environmental variables?

To access the shell environmental variables, you should use the “env” lookup plugin. Here an example is given below for your reference –

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

Q20). How to speed up management within EC2 instance?

This is not recommended managing EC2 group from your personal computer. The best idea is connecting with the management node within EC2 first then start executing Ansible at another end.