Ansible Interview Questions and Answers 1

Q1) What do you know about Ansible?

Answer: Ansible is the well-recognized open-source platform written and developed in Python language. This platform facilitates task automation, configuration management, and application deployment. It uses the SSH approach to deploy the application without any specific downtime.

Q2) Explain the use of Ansible?

Answer: automation is a crucial part of any software development process. The Ansible platform used in managing various IT infrastructure. It is also used for deploying software applications to remote nodes.

Q3) What are the major advantages of using Ansible?

Answer: Using Ansible can be beneficial in numerous ways. Then three of its advantages are mentioned below:

Agentless

Very low overhead and easy to learn

Great performance

READ ALSO
Ansible Interview Questions 4

Consistent with security

Reliable

Q4) Explain the Ansible Galaxy.

Answer: As Ansible facilitates bundling automation content. This makes it reusable. The Ansible galleries are needed here to share such Ansible roles. In simple words, the Ansible gallery is the

tool which is merged with the Ansible. This integration creates the base directory structure.

Q5) What is continuous delivery in terms of Ansible?

Answer: It is the practice that involves delivering the software as soon as it is developed. For this, there is a need to use the versioning control system. Even in the live production system the software consistently updates.

Q6) How do Ansible works?

Answer: There are two main categories of server type in Ansible: the nodes and controlling machine. It simply uses the SSH protocol to deploy modules to nodes. These nodes stored in remote nodes interact with Ansible Machine. The Ansible has the capability to manage more than 100 nodes in one single system.

READ ALSO
Ansible Interview Questions 2

Q7) Name different modules in Ansible.

Answer: In Ansible there are two major types of modules: core modules and extra modules.

Core Modules: These modules are the first preference of the Ansible team. The core modules come with Ansible software.

Extra Modules: The extra modules are reusable but for some reason, they always get a lower rate of response to issues. These are also maintained and managed by the Ansible Community. Although the extra modules are merged with Ansible but one can use it separately in the future.

Q8) Explain the Ansible tower.

Answer: The Ansible is the web-based center which is used for all kind of automation tasks. There is no requirement to install the daemons to connect with other controlling machines as it is an agentless model. The Ansible tower allows you free usage till ten nodes.

READ ALSO
Ansible Interview Questions 6

Q9) What is the difference between Ansible and Puppet?

Answer: Ansible: The Ansible has the simplest technology written in the YAML language. It can be quickly installed and deployed because of agent-less architecture. The Ansible supports automated workflow for continuous delivery.

Puppet: The puppet has complex technology in comparison to Ansible. This is written in Ruby language. To access this, it is important to learn Puppet DSL.

Q10) Give a brief about Ansible architecture.

Answer: The Ansible is highly based on the agent-less architecture. This structure enables you to connect your nodes. The pool of modules can dwell on any system without any daemons, server or the database. The SSH protocol enables it to execute these modules. It removes them as soon as work is done.

READ ALSO
Ansible Interview Questions 3

variable name?

Answer: The variable name can be created by adding stings. On the other hand, for the access of environment variable, there is a need to access the existing variables. The variable name uses ipv4 for the available name. For remote environment variables {{ ansible_env.SOME_VARIABLE }} is used.

Q12) What are the things Ansible can do?

Answer: With the Ansible these are the following things one can do:

Deployment of application

Configuration management

Task automation

IT orchestration

Q13) What language Ansible is written in?

Answer: The Ansible is written in PowerShell and Python programming language.

Q14) Can you please explain the meaning of the red hat Ansible?

READ ALSO
Ansible Interview Questions and Answers 2

Answer: The red hat Ansible and Ansible both all the great automation platforms. The end to end complete automation of these platforms makes it capable to provide below-mentioned functionalities:

Application deployment

Provisioning

Management and configuration of IT systems

Orchestrating workflows

Q15) What are the requirements of the Ansible server?

Answer: For the window users, there is a need for the virtual machine in which the Linux should be installed. Otherwise, the Ansible requires Python 2.6 version or the higher one.

Q16) Is it possible to create own modules with Ansible?

Answer: Yes, the Ansible allows us to create the modules within it. As it is an open-source tool that majorly runs on Python. This means anyone who has little bit knowledge of programming can create their own modules without any problem within Ansible.

READ ALSO
How to drop all schema objects in Oracle

module?

Answer: The availability of mkpassword utility in Linux is the best option for generating the crypto

generate crypto passwords by using Python.

Q18) Name the different components of Ansible.

Answer: Ansible automation is consist of the following elements:

Inventories

Modules

APIs

Host

Playbooks

Cloud

Networking

Q19) How can we make content redistributable and reusable?

Answer: In Ansible there are three major ways to reuse files in playbooks which include import and roles.

Q20) Explain the way to access shell environment variables in Ansible.

plugin. There are some codes that you have to write for this. The codes are mentioned below:

READ ALSO
How to check database lock conflict in Oracle

vars :

Q21) Is it possible to keep secret data in the playbook?

Answer: Yes, it is possible to keep secret data in your Ansible content with the use of Vault in playbooks. With V mode you have to use some commands to hide sensitive data from others.

Q22) Explain ad-hoc commands.

Answer: The ad-hocs are used to take action on the hosts without writing the playbooks. So, if you have to reboot the hosts in a specific group then there are two ways to do that. You can either create a new playbook or you can simply use the one-off ad-hoc command.

used by Ansible to get information about the host and store. The Ansible runs the setup modules to generate these facts.

READ ALSO
AWS Interview Questions 8

Q24) What is the right way to copy files recursively onto a target host?

Q25) Explain the meaning of Ansible tasks.

Answer: The Ansible tasks are majorly used to break up bits of configuration policy in little files.

These small blocks of code that are used to automate any process.

Q26) Explain the Ansible role and what makes it different from the playbooks?

Answer: The Ansible role is completely another level of abstraction. These are used to organize playbooks. It provides an independent structure and a reusable collection of various things. It includes templates, files, variables, tasks, etc.

Q27) Why Ansible vaults are used?

READ ALSO
AWS Interview Questions 1

Answer: The Ansible vaults are used to keep all your secret data safe. It facilitates the encryption of sensitive data but also integrates them into your playbooks. The files can either be entirely encrypted or unencrypted, the vault is implemented with file-level granularity. The Ansible vaults are very user-friendly.

Q28) Explain the features of the Ansible tower.

Answer: The Ansible towers display everything happening in the Ansible environment like inventory status, hosts and other recent activities. It also integrates the notifications about all the necessary updates. The multi-playbook workflow feature of Ansible tower makes it easier to chain all the playbooks. It is also useful for scheduling Ansible jobs.

READ ALSO
How to check last user login Oracle

Q29) How can you connect other devices within Ansible?

Answer: After installing Ansible on the controlling systems, one inventory file is created which particularly explains the connection between other nodes. The SSH protocol can be used to make a connection. If you want to check its connection, then you can use the ping module. The command to check this connection is: ansible -m ping all

Q30) Does Ansible support AWS?

Answer: There are hundreds of modules present in Ansible that support AWS. It includes:

Autoscaling groups

CloudFormation

Virtual Private Cloud (VPC)

Security Groups

Relational Database Service (RDS)

CloudTrail

Elastic Cloud Compute (EC2)

READ ALSO
How to check scheduler jobs in Oracle

module?

  1. file
  1. absent
  2. folder
  3. link

Answer: Folder

Q32) Which module can be utilized to copy files from a remote machine to a control machine?

  1. ping
  2. fetch
  3. copy
  4. move

Answer: fetch

Q33) If you do not need any facts from the host, what command would you use?

  1. gather_facts: no
  2. gather_facts: False
  3. both gather_facts: no or gather_facts: False
  4. gather_facts: y

Answer: gather_facts: no

Q34)Where is Inventory file located by default?

  1. /etc/ansible/hosts
  1. /etc/inventory
  2. /etc/configurations
  3. /etc/ansible

Answer: /etc/ansible/hosts

Q35) What is the default location for Ansible?

Answer:Default location for Ansible modules is /usr/share/ansible

Q36) What module can be utilized to stop a playbook execution for a specific period?

  1. Sleep
  2. Pause
  3. Stop
  4. Suspend
READ ALSO
Ansible Interview Questions 1

Answer: Pause

Q37) Which module will you utilize to create a directory?

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

Answer: File

Q38) Which module can be used to force a handler to run in between

two tasks?

  1. Flush
  2. None of the options
  3. assest
  4. meta

Answer: meta

Q39) Which Ansible module is utilized for managing docker services and containers?

  1. docker_service
  2. docker_login
  3. docker_image
  4. docker

Answer: docker_service

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
READ ALSO
Using R on Amazon EC2 under the Free Usage Tier

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

Ansible

Puppet

chef

CFEngine

Answer: Ansible

Q45) Ansible is generally referred to as what?

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?

READ ALSO
Ansible Interview Questions 5

Answer: Ansible Tower Interface

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

Answer:

yum install ansible

Once the installation is completed, check the ansible version :

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?

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:

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

READ ALSO
AWS Interview Questions 4

Step 5: /home/gangboard/.ssh/id_rsa.pub => 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.

Answer:

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

Step 2:

Step 3: Create .ssh directory mkdir .ssh

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/id_rsa.pub]

Now you able to access the server without a password.