Ansible Interview Questions 6

Q71) What is configuration management?

Answer: Configuration management is a process of continuous deployment and continuous delivery and continuous monitoring of the many servers in less period of time to achieve deliverables.

Q72) How to execute the created roles?

þÿ A n s w e r :

hosts: true

role:

þÿ a p a c h e < r o l e n a m e >

Q73) How to use existing tasks in Ansible?

Answer: by using import_tasks:

Q74) How to use ansible-galaxy to download roles?

Answer: ansible-galaxy install username.rolename

Q75) What is ansible jinja2 templates?

Answer: It is a file that contains all dynamic configurations parameters which will be having .j2 extension.

Q76) How to do role duplication and execution?

READ ALSO
Deploying a Database-Driven Web Application in Amazon Web Services

Answer: using allow_duplicates: true

Q77) What are the role dependencies?

Answer: Role default variables allow you to set the default variables for included or dependencies

Dependencies:

Role: tire

Role: brake

Q78) How to secure Ansible playbooks?

Answer: We have concept called ansible-vault .which encrypts the YAML files.

Q79) How to encrypt and decrypt Ansible playbooks?

Answer: Using ansible-vault encrypt and ansible-vault decrypt

Q80) How to change the existing password for ansible vault?

Answer: ansible-vault rekey

Q81) How to install Ansible on Linux?

Answer: First we need to install epel repo and then install ansible

Yum install epel-repo

READ ALSO
How to check query plan change in oracle

Yum install ansible

Q82) Which module copies a dynamically generated file from control machine to target

  1. template
  2. file
  3. fetch
  4. copy

Answer: Template

Q83) How do you define ansible in the configuration management perspective?

Answer: Anything can be deployed/configured/installed by using ansible in the list of servers

þÿ w i t h o u t e v e n t o u c h i n g t h e s e r v e r w h i c h a c t u a l l y d o e s n t n e e d a n y c l i e n t s þÿ t h e s e r v e r s i n c e i t o p e r a t e s i n s s h m o d e . T h a t s w h y i t i s c a l l e d a g e n t l e configuration management service

Q83) Do u know how to illustrate the working of Ansible ?

Answer: Yes, Ansible should be setup on a dedicated server which contains modules, inventories configured. Inventory contains the list of the target host which we want to connect/deploy/install/configure. That is simply a yaml file contained group name, server details. Modules are predefined in ansible which has the actual implementation definition on the ansible libraries. Host machines i.e target machines are connected via ssh and executes using python interpreter since all the definitions converted into python.

READ ALSO
Lab. Getting Started with Amazon Web Services (AWS)

Q84) How do you define ansible is useful in the automation paradigm?

Answer: Automation is a sequence of operation which is done manually by the admin which is not possible over a thousands of server but that has to be managed from some place so ansible server is needed and all the server need not to be configured with some agent which takes operational headache all these can be overcome by the Ansible configuration management.

Q84) Do you know any API reference for Ansible ?

Answer: Yes, Ansible works on Rest API call which can be achieved by using ansible tower. It gives an option to use RBAC which is secured to access the secured ssh credentials

READ ALSO
How to disable firewall in Linux 7

Q85) Will you be able to restart the target machines with Ansible?

Answer: Yes, we can restart the machines since it is OS operations, we have reboot module that has to be added in the tasks of the playbook to restart the machine

Q86) Do you know what are all the features of Ansible beyond automation?

Answer: Yes, It is not only for task automation, we can also perform beyond that. Cloud infrastructure automation can be performed using that, you can deploy the application to servers by using ansible, you can perform configuration management which is the main feature, and you can orchestrate multiple IT environment

READ ALSO
Raster Vector Data Analysis ~ Hiking Path Finder

Q87) How ansible is executing just by YAML script?

Answer: Actually Ansible is not written in YAML, it has written in python programming and

þÿ P o w e r s h e l l . S o , Y A M L i s g e t t i n g c o n v e r t e d t o i t t h a t s h o w i t w o r k s

Q88) Do you know ansible cannot be considered as opensource?

Answer: That is completely wrong, Ansible is opensource whereas Redhat Ansible is customized

by Redht

Q89) Server requirement for Ansible how will it look like ?

Answer: Here Ansible server should have linux installed and python version should be 2.6 or higher.

Q90) So do you have an option do customize you own ansible modules?

Answer: Yes, Since it is an opensource tool, you have an option to customize it. But the clear requirement is you should be a good programmer so that you can get started to develop your

READ ALSO
How to backup archivelog for specific sequence RMAN

þÿ o w n m o d u l e f o r A n s i b l e . Y o u d o n t n e e d a n y e x t r a o r d i n a r y p r i o r e x p e r i e n module

Q91) Do you know the other way around to perform ansible operations without writing playbooks ?

Answer: We have an option to write our single task and execute it without even writing playbook that is called ad-hoc commands. Which is like normal Ansible CLI commands which passes required modules and arguments for the modules, and the targeted host groups in a single command.

Q92) Do you know how do we parameterize the arguments required for the module ?

Answer: This can be done in the playbook or roles when you write it, you have to use variables and its value under vars section in playbook. If it is roles, it has to be in the vars folder and main.yaml file.

READ ALSO
How to check last CPU applied in Oracle

Example:

vars:

myvar1: value

myvar2: value

Q93) Will you be able to see the host machine all variables using

ansible?

Answer: Yes we have a module called debug module. Either you can write playbook or adhoc commands, both the way it can be achieved. Pass the arguments as

þÿ v a r = h o s t v a r s [ i n v e n t o r y _ h o s t n a m e ] l o c a l h o s t t h i s g e t s t h e v a r i a b l e s o f

Q94) Could you differentiate Roles and Playbooks?

Answer: Roles are written as a collection which contains tasks, vars, default vars, metadata information, handlers, files all separated in different folder whereas in playbook which contains all in a single file. Roles can be shared with ansible galaxy so that others can easily pull it without any dependency

READ ALSO
Windows Azure Interview Questions

Q95) Differentiate ask_pass and ask_sudo_pass

Answer: Yes Ask_pass default value is actually no, if you want it to enable explicitly you can set it as True. This enables option to ask password whereas ask_sudo_pass will be prompted when sudo password is required to entered by the user.

Q96) Do you know how do we make use of our ansible script reusable or redistributable ?

Answer: Yes roles is the only way we can use this. Roles ensures that can be distributed or redistributed with the updated content . This contains document which says how to use the roles.

Q97) Do we hav option to copy a file from my ansible server to all server ?

READ ALSO
Ansible Interview Questions 2

Answer: Yes, we have option to copy files from ansible servers to all the servers. We have file module which does that. You can also copy files with changing or without changing permissions, owners, groups etc.

Q98) How can u encrypt ansible passwords or any data ?

Answer: We have ansible vault which protects all the confidential information which is needs to

be protected from the end user.

Q99) How will you ensure the targeted server connection is established ?

Answer: We can use ping module which tries to ping all the servers in the inventory files. This will

þÿ g i v e p o n g a s r e s p o n s e i f t h e s e r v e r i s p i n g a b l e . T h e a d – h o c c o m m a n d s whether the servers are reachable with ansible server or not. The syntax of the commands is

READ ALSO
Ansible Interview Questions 7

þÿ a n s i b l e – m p i n g < g r o u p n a m e >

Q100) What are playbooks in ansible ?

Answer: Playbooks are the scripts that we use in Ansible. They are used as building blocks that you can use to execute on remote machine. The scripts will contain the instructions that needs to be executed on the remote machines. This script follows a yaml format so you have to very careful with the indentation.