Ansible is a configuration management tool which is mainly used for application deployment, task automation, and server configuration which greatly enhances business agility by reducing operational costs, response times, and providing greater benefits to organisations.We have come up with a few Ansible interview questions which will surely help you to be more confident in your interview.
Ansible is an open source automation platform that is used for configuration management, application deployment task automation etc.
It can also do I-T orchestration to run tasks in sequence and create a chain of events which must happen on several different servers or devices. It is developed in Python language. It is useful while deploying any application using ssh without any downtime.
In simple terms Ansible enables us to define our infrastructure as code(IAC) in a simple declarative manner.
There are two ways to install it.
Once Ansible is installed, then verify it with command 'ansible --version' on the terminal.
Playbook is a way to send commands to remote computers in a scripted way and has a collection of YAML based files. Instead of using Ansible commands individually to remotely configure computers from the command line, we can configure entire complex environments by passing a script to one or more systems. For example, install and configure something. Basically, a series of resources (e.g. package, copy, file etc) that will achieve our end result in the correct order.
Knowledge Area: Project Quality Management
Managing the quality of the project deliverables is extremely important. Quality of the deliverables is ensured by doing both Quality Assurance and Quality Control.
Quality Assurance comes from the laid down processes and standards to do the project work. Adherence to the processes and standards assures that the final deliverables will meet the expected standards of quality. This is done proactively through the execution and development.
Quality Control is the process of monitoring the final deliverables and results created by the team after adhering to the chosen processes and standards. Quality Control uses inspection to check if the final deliverable is correct in all respect and meets all the expected specification or not.
For more detailed understanding on the above topic, refer: Qualty assurance and quality control
On the local machine user uses playbook to configure and manage the execution YAML based scripts. Main building blocks of Ansible are playbook, plugins, modules, host inventories, group_vars, roles, handlers, and tags. Using these components we define our configuration and scripts and that is executed on the remote nodes using SSH tunneling. Commands/steps in scripts are executed in order but execution happens in parallel on multiple remote nodes managed by Ansible. Ansible pushes out small program termed as 'modules'; which are responsible for performing all heavy liftings.
Ansible carries out these modules upon the SSH by default and eliminates them from the remote node machine when finished.
Workflows are only available with Enterprise-level licenses. Workflows allow configuring a sequence of disparate job templates that may or may not share inventory, playbooks, or permissions. However, workflows have ‘admin’ and ‘execute’ permissions, similar to job templates. A workflow accomplishes the task of tracking the full set of jobs that were part of the release process as a single unit.
A workflow job can have the following states (no Failed
Ansible Tower is an enterprise framework for controlling, securing and managing Ansible automation with a UI and restful API.
It provides the following features
Ansible playbook files can be reused in multiple ways. Imports and Include are helpful to create/break up multiple small files of a massive playbook. Roles are primarily used to manage various tasks in a package including handlers, variables, plug-in and other modules. They can also be uploaded and shared by Ansible Galaxy. Ansible Tower automatically fetches the roles that playbook needs from Galaxy, GitHub, or your local source control.
Ansible works by connecting to the remote nodes over SSH and pushing out small programs, called 'modules' to them. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules and removes them when finished.
Ansible ships with a number of readymade modules (called the 'module library') that can be executed directly on remote hosts or through Playbooks. Users can also write their own modules. These modules can control system resources, like services, packages, or files (anything really), or handle executing system commands.
Whenever we run an Ansible playbook, Ansible first gathers information ('facts' an exhaustive list of all the environment details) about each host in the play. Facts can be extremely helpful when we’re running playbooks; we can use gathered information like host IP addresses, CPU type, disk space, operating system information, and network interface information to change when certain tasks are run or to change certain information used in configuration files.
To get a list of every gathered fact available, we can use 'ansible munin -m setup' command with the setup module.
There are two types of variables that can be defined in a role:
Ansible is a configuration management tool which is mainly used for application deployment, task automation, and server configuration which greatly enhances business agility by reducing operational costs, response times, and providing greater benefits to organisations. It is a very popular tool which is fairly easy to use and helps in IT orchestration and can handle complex tasks.
We have come up with a few Ansible interview questions which will surely help you to be more confident in your interview. The following interview questions on Ansible have been designed by experts and intends to give you a glimpse of the interview questions which you might face while you appear for your Ansible interview: