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.
12th Dec, 2019
Below are few major features of Ansible
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.
//syntax 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,
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.
//example 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.
//usage 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,
|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.|