Ansible Interview Questions 4

Q40) Ansible has two types of servers. Select the appropriate answer from the given options.

  1. only node
  2. controlling machines and nodes

Answer: controlling machines and nodes

Q41) How to define the number of parallel processes while communicating to remote hosts?

  1. pipelining
  2. Forks
  3. become_method
  4. become

Answer: Forks

Q42) What is the default forks value in configuration file?

  1. 1
  2. 5
  3. 7
  4. depends upon hosts in the inventory

Answer: 5

Q43) How can you reduce the number of SSH connections required?

  1. accelerate port
  2. pipelining
  3. forks
  4. become_method

Answer: pipelining

Q44) Which configuration management is agentless





Answer: Ansible

Q45) Ansible is generally referred to as what?

What is DevOps? Introduction to DevOps 2

Infrastructure as code

Orchestration Engine

Configuration management

All the options

Answer: All the options

Q46) How would you write comments on Jinja2:

  1. {{}}
  2. {##}
  3. {%%}

Answer: {##}

Q47) What is the web-based interface used to access projects, inventories, job templates and jobs Ansible?

Answer: Ansible Tower Interface

Q48) How to Install Ansible in the Redhat Linux operating system?


yum install ansible

Once the installation is completed, check the ansible version :

þÿ a n s i b l e v e r s i o n

If ansible package is not available in the default yum repositories, we need to manualy download.

Q49) How to set SSH-based access from Controller to Managed Nodes which is recommended by Ansible?

Comparing Amazon s3 vs. Redshift vs. RDS

Answer: It provides passwordless auth to access the managed servers

In Control Server.

Step 1: Create user for ansible useradd -d /home/gangboard -m gangboard passwd gangboard

Step 2: Switch to ansible user

Step 3:þÿ s u g a n g b o a r d

Step 4: Generate ssh key ssh-keygen -t rsa

Step 5: /home/gangboard/.ssh/ => Public Key is in this file which needs to be copied to nodes ~/.ssh/authorized_keys

Q50) Perform the following setps on all Managed nodes.


Step 1: Create user for ansible useradd -d /home/tadmin -m tadmin passwd tadmin

Step 2:þÿ Switch to ansible users at admin

Step 3: Create .ssh directory mkdir .ssh

Ansible Interview Questions and Answers 1

Step 4: Change permission to 700 for .ssh chmod 700 .ssh/

Step 5: Change Ownership to tadmin for .ssh chown tadmin:tadmin .ssh/

Step 6: create an authorized_keys file under .ssh and paste the public key from controller and

save it

Step 7: cd .ssh/ , vi authorized_keys


Step 8: Copy & paste the public key from the Controller server to this file [/home/tadmin/.ssh/]

Now you able to access the server without a password.

Q51) What is inventory in Ansible and how to update it?


The inventory files contain a host list of managed nodes, when ansible accessing the client it look into inventory.

How to delete files older than X days in Linux

The default inventory file for Ansible is located under /etc/ansible/hosts

This default inventory lookup can be overridden using -i option providingthe custom inventory file

Example: ansible -i cmdb.inv main.yml Update default Inventoryfile/etc/ansible/hosts (as rootuser) [clients]



Q52) How to run ansible command? Briefly explain?


Running ansible command #ansible all -m ping

ansible => Ansible command

all => Specifies the target to run the command.The target could an individual node or group(mentionedininventoryfile)orall(allthenodesintheinventory file). In this case all is used, which means that the command will be executed on all the nodes.

-m is the option that indicates that a module needs to be executed on remote nodes

Ansible Interview Questions 5

ping is the name of a module. This module checks the ping status of the remote node. It has no attribute parameter (-a)