Q40) Ansible has two types of servers. Select the appropriate answer from the given options.
- only node
- controlling machines and nodes
Answer: controlling machines and nodes
Q41) How to define the number of parallel processes while communicating to remote hosts?
Q42) What is the default forks value in configuration file?
- depends upon hosts in the inventory
Q43) How can you reduce the number of SSH connections required?
- accelerate port
Q44) Which configuration management is agentless
Q45) Ansible is generally referred to as what?
Infrastructure as code
All the options
Answer: All the options
Q46) How would you write comments on Jinja2:
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?
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/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.
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
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
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.
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.
This default inventory lookup can be overridden using -i option providingthe custom inventory file
Q52) How to run ansible command? Briefly explain?
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
ping is the name of a module. This module checks the ping status of the remote node. It has no attribute parameter (-a)