Ansible Introuduction

  Ansible It is a RedHat It is a configuration management tool It is a Push based configuration tool. It is infrastructure as a Code ( IaC...


  • It is a RedHat
  • It is a configuration management tool
  • It is a Push based configuration tool.
  • It is infrastructure as a Code (IaC) but we can manage network, containers, cloud, security, applications using Ansible
  • It is agentless means we need to install Ansible only on the Master node and connect to the agent using the master's ssh public key( ssh-keygen)
  • To Manage IaC using Ansible you can use Ansible Adhoc Commands or Ansible playbooks (script).

Ansible Architecture.

Master Server

The Server where Ansible is installed and using Ansible you are managing the configuration on host machines (Agent machine)

Host servers/machines

These are agent machines where you need to change the configuration using Ansible. For example, if you need to change the configuration on webservers and DB servers then webservers and DB servers are host servers.

Inventory or host file. 

It is a file where all host machines' IP addresses or FQDN ( Full qualified domain name) are mentioned.

By default the path is /etc/ansible/hosts

Below are the formats by which we can configure hosts machines IP or FQDN in the hosts file

IP Addresses:- You can specify the IP addresses of your host machine.

Group:- You can add IP address which is relevant to a group. For example, if you have 2 IPs and are web servers then you can specify a group called webservers


Range:- You can also define a range of domain names in the host file. In below example, we are specifying domain names like db-99.mydomain to


Ansible Modules

  • Modules are used to accomplish automation tasks in Ansible. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules and removes them when finished. Without modules, you'd have to rely on ad-hoc commands and scripting to accomplish tasks.
  • Modules are used with Adhoc commands as well as with playbooks.
  • Modules are having attributes or properties which help to define the desired state of a given task.
  • For example, if you want to install an apache server on a Ubuntu machine then the apt module has a property called name and state where name indicates package name (apache2) and state indicates installed, removed etc.
  • To display all the modules ( ansible-doc -l)
  • To search a particular module ( ansible-doc -s yum)


  1. yum module represents yum package manager
  2. apt module represents package manager for Debian-based OS.

Ansible configuration file (ansible.cfg)

It is the file that has settings related to the Ansible package.

for example

Change the inventory path

Change role path

Ansible Adhoc Commands:

An Ansible ad hoc command uses the /usr/bin/ansible command-line tool to automate a single task on one or more managed nodes. ad hoc commands are quick and easy, but they are not reusable. So why learn about ad hoc commands first? ad hoc commands demonstrate the simplicity and power of Ansible.

Ansible PlayBooks:

Ansible playbooks are the script files that are used for managing the infrastructure on host machines that are configured in the inventory file.For example if you want to install a package on Webservers then you can write a yaml script (playbook) to install package on webservers.




Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,git quiz,1,Git Worksheet,1,Jira,3,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SDLC Quiz,4,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
DevOpsWorld: Ansible Introuduction
Ansible Introuduction
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content