SlideShare a Scribd company logo
2
Most read
8
Most read
15
Most read
Introduction to Ansible
Ansible
● Free automation tool that enables infrastructure as
code
● Ansible Inc was purchased by Red Hat in 2015
● Open-source and community driven
● Written in Python
● Used for
○ Provision system
○ Configure system
○ Deploy Apps
○ Manage system and Apps
Without Ansible :
With Ansible :
Ansible Benefits
● Agentless and easy to use
● Automates repetitive tasks, saving time and reducing errors
● Flexible with simple, human-readable configuration files
● Secure with SSH-based operations
● Includes pre-built modules for diverse tasks
● Supports orchestration for systems, networks, storage, and cloud
Ansible Architecture
Source : Ansible Architecture - Detailed Explanation - InterviewBit
Key Terminologies
● Control Node or Ansible Server :
Manages and executes Ansible
automation across managed nodes
● Inventory : Organized list of managed
nodes in Ansible
● Managed node : A remote system, or
host, that Ansible controls
Source : Getting started with Ansible — Ansible Community
Documentation
Source : Ansible Playbooks-javatpoint
● Modules : Command meant to be executed on the client-side
Examples of modules -
1. Install http
2. Enable http service
3. Start http service
● Task : Single action executed on managed nodes, such as installing a package etc.
It can have multiple modules
● Play : Group of ordered tasks executed collectively
● Playbook : Automation files containing one or more plays detailing the sequential
execution of tasks
● A Task in Ansible uses a Module
● Multiple Modules for related Tasks form a Play
● Plays together make a Playbook
● Playbooks are written in YAML format
Ansible Roles
● Package various automation components together
● Components including tasks, handlers, variables, plugins, templates, and
files
● Can be reused across different plays or playbooks
● Enable sharing and collaboration among automation users
● Stored at /etc/ansible/roles
Ansible Configuration Files
● /etc/ansible : Default directory
● /etc/ansible/ansible.cfg: Main configuration file for Ansible settings
● /etc/ansible/hosts: Lists managed nodes and their details
● /etc/ansible/roles/: Directory for organizing reusable playbook
components.
ansible.cfg
common parameters that can be defined in config file
Install Ansible
● Install ansible on rhel 9
Command : dnf install-y ansible-core
Documentation-Installing Ansible — Ansible Community Documentation
● Check ansible version and verify installation
Command : ansible–version
YAML File Syntax
YAML File Syntax
● All tasks are executed in sequential order
● Each task is processed one at a time
● Indentation is extremely important
● No <tabs> only use spaces in yaml
● Empty lines have no value
● File extension is usually .yml or .yaml
● No difference in double quotes or NO quotes for a task name
● There is NO need to modify the file permission
Create First Playbook
● Make ‘playbooks’ dir in /etc/ansible and create ‘myfirstplaybook.yml’
Name of playbook
Where to run
Name of task
Run ping module
Declare task
Start yml file
● Check syntax of playbook
Command : ansible-playbook--syntax-check /etc/ansible/playbook/myfirstplaybook.yml
● Dry run the playbook before execution
Command : ansible-playbook-check /etc/ansible/playbook/myfirstplaybook.yml
● Run the playbook
Command : ansible-playbook /etc/ansible/playbook/myfirstplaybook.yml
Ansible Modules
Link : All modules — Ansible Documentation

More Related Content

PPTX
Ansible as configuration management tool for devops
PPTX
Introduction to ansible
PPTX
SESSION Ansible how to deploy and push resources
PPTX
Ansible
PPTX
installation and introduction to Ansible
PDF
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
PPTX
Intro to-ansible-sep7-meetup
Ansible as configuration management tool for devops
Introduction to ansible
SESSION Ansible how to deploy and push resources
Ansible
installation and introduction to Ansible
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Intro to-ansible-sep7-meetup

Similar to Introduction to Ansible in RHEL- RHCE.pdf (20)

PPTX
Introduction to Ansible
PPTX
Introduction to Ansible
PDF
Network Automation: Ansible 101
PPTX
Ansible_Presentation.pptx in devops 6th sem lab
ODP
Introduction to Ansible
PPTX
Introduction to ansible
PDF
Top 50 Ansible Interview Questions And Answers in 2023.pdf
PDF
ansible_rhel.pdf
PDF
Introducing Ansible
PDF
Automate with Ansible basic (2/e, English)
PPTX
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
PDF
Ansible
PPTX
Hands on ansible
PDF
#OktoCampus - Workshop : An introduction to Ansible
PPTX
Automating with Ansible
PPTX
Mastering_Ansible_PAnsible_Presentation our score increases as you pick a
PDF
Ansible
PDF
Ansible is the simplest way to automate. MoldCamp, 2015
PPT
Ansible Introduction
PDF
Ansible_Basics_ppt.pdf
Introduction to Ansible
Introduction to Ansible
Network Automation: Ansible 101
Ansible_Presentation.pptx in devops 6th sem lab
Introduction to Ansible
Introduction to ansible
Top 50 Ansible Interview Questions And Answers in 2023.pdf
ansible_rhel.pdf
Introducing Ansible
Automate with Ansible basic (2/e, English)
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible
Hands on ansible
#OktoCampus - Workshop : An introduction to Ansible
Automating with Ansible
Mastering_Ansible_PAnsible_Presentation our score increases as you pick a
Ansible
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible Introduction
Ansible_Basics_ppt.pdf
Ad

More from RHCSA Guru (20)

PDF
How to Set Up a RHEL 9 Virtual Lab for RHCSA Practice.pdf
PDF
CompTIA Linux (Plus) Exam Overview .pdf
PDF
Linux Professional Institute LPIC-1 Exam.pdf
PDF
LVM Management & Disaster Recovery - RHCSA+.pdf
PDF
Managing Multiple Logical Volumes - RHCSA+.pdf
PDF
Master Logical Volume Management - RHCSA+.pdf
PDF
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdf
PDF
Ansible Variables in Playbook - RHCE.pdf
PDF
Comprehensive Guide to Ansible Application Roles.pdf
PDF
Using Tags in Ansible Playbooks RHCE.pdf
PDF
Comprehensive Guide to Ansible Roles - RHCE
PDF
Mastering Handlers, Conditions, and Loops in Ansible Playbooks - RHCE.pdf
PDF
Essential Ad-hoc Commands in Ansible - RHCE.pdf
PDF
RHEL in Shell Scripting Advanced - RHCSA+.pdf
PDF
Shell Scripting Intermediate - RHCSA+.pdf
PDF
Introduction to Shell Scripting - RHCSA+.pdf
PDF
Command Line Text Processing - RHCSA +.pdf
PDF
Mounting and Creating Links - RHCSA (RH124) .pdf
PDF
Basic Command Line Tools - RHCSA (RH124).pdf
PDF
Podman Networking Essentials - RHCSA+.pdf
How to Set Up a RHEL 9 Virtual Lab for RHCSA Practice.pdf
CompTIA Linux (Plus) Exam Overview .pdf
Linux Professional Institute LPIC-1 Exam.pdf
LVM Management & Disaster Recovery - RHCSA+.pdf
Managing Multiple Logical Volumes - RHCSA+.pdf
Master Logical Volume Management - RHCSA+.pdf
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdf
Ansible Variables in Playbook - RHCE.pdf
Comprehensive Guide to Ansible Application Roles.pdf
Using Tags in Ansible Playbooks RHCE.pdf
Comprehensive Guide to Ansible Roles - RHCE
Mastering Handlers, Conditions, and Loops in Ansible Playbooks - RHCE.pdf
Essential Ad-hoc Commands in Ansible - RHCE.pdf
RHEL in Shell Scripting Advanced - RHCSA+.pdf
Shell Scripting Intermediate - RHCSA+.pdf
Introduction to Shell Scripting - RHCSA+.pdf
Command Line Text Processing - RHCSA +.pdf
Mounting and Creating Links - RHCSA (RH124) .pdf
Basic Command Line Tools - RHCSA (RH124).pdf
Podman Networking Essentials - RHCSA+.pdf
Ad

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
Teaching material agriculture food technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Modernizing your data center with Dell and AMD
PPTX
Big Data Technologies - Introduction.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Unlocking AI with Model Context Protocol (MCP)
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Teaching material agriculture food technology
Digital-Transformation-Roadmap-for-Companies.pptx
Machine learning based COVID-19 study performance prediction
Advanced methodologies resolving dimensionality complications for autism neur...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
The Rise and Fall of 3GPP – Time for a Sabbatical?
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Modernizing your data center with Dell and AMD
Big Data Technologies - Introduction.pptx
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Network Security Unit 5.pdf for BCA BBA.
20250228 LYD VKU AI Blended-Learning.pptx
Understanding_Digital_Forensics_Presentation.pptx

Introduction to Ansible in RHEL- RHCE.pdf

  • 2. Ansible ● Free automation tool that enables infrastructure as code ● Ansible Inc was purchased by Red Hat in 2015 ● Open-source and community driven ● Written in Python ● Used for ○ Provision system ○ Configure system ○ Deploy Apps ○ Manage system and Apps
  • 4. Ansible Benefits ● Agentless and easy to use ● Automates repetitive tasks, saving time and reducing errors ● Flexible with simple, human-readable configuration files ● Secure with SSH-based operations ● Includes pre-built modules for diverse tasks ● Supports orchestration for systems, networks, storage, and cloud
  • 5. Ansible Architecture Source : Ansible Architecture - Detailed Explanation - InterviewBit
  • 6. Key Terminologies ● Control Node or Ansible Server : Manages and executes Ansible automation across managed nodes ● Inventory : Organized list of managed nodes in Ansible ● Managed node : A remote system, or host, that Ansible controls Source : Getting started with Ansible — Ansible Community Documentation
  • 7. Source : Ansible Playbooks-javatpoint
  • 8. ● Modules : Command meant to be executed on the client-side Examples of modules - 1. Install http 2. Enable http service 3. Start http service ● Task : Single action executed on managed nodes, such as installing a package etc. It can have multiple modules ● Play : Group of ordered tasks executed collectively ● Playbook : Automation files containing one or more plays detailing the sequential execution of tasks
  • 9. ● A Task in Ansible uses a Module ● Multiple Modules for related Tasks form a Play ● Plays together make a Playbook ● Playbooks are written in YAML format
  • 10. Ansible Roles ● Package various automation components together ● Components including tasks, handlers, variables, plugins, templates, and files ● Can be reused across different plays or playbooks ● Enable sharing and collaboration among automation users ● Stored at /etc/ansible/roles
  • 11. Ansible Configuration Files ● /etc/ansible : Default directory ● /etc/ansible/ansible.cfg: Main configuration file for Ansible settings ● /etc/ansible/hosts: Lists managed nodes and their details ● /etc/ansible/roles/: Directory for organizing reusable playbook components.
  • 12. ansible.cfg common parameters that can be defined in config file
  • 13. Install Ansible ● Install ansible on rhel 9 Command : dnf install-y ansible-core Documentation-Installing Ansible — Ansible Community Documentation
  • 14. ● Check ansible version and verify installation Command : ansible–version
  • 16. YAML File Syntax ● All tasks are executed in sequential order ● Each task is processed one at a time ● Indentation is extremely important ● No <tabs> only use spaces in yaml ● Empty lines have no value ● File extension is usually .yml or .yaml ● No difference in double quotes or NO quotes for a task name ● There is NO need to modify the file permission
  • 17. Create First Playbook ● Make ‘playbooks’ dir in /etc/ansible and create ‘myfirstplaybook.yml’ Name of playbook Where to run Name of task Run ping module Declare task Start yml file
  • 18. ● Check syntax of playbook Command : ansible-playbook--syntax-check /etc/ansible/playbook/myfirstplaybook.yml
  • 19. ● Dry run the playbook before execution Command : ansible-playbook-check /etc/ansible/playbook/myfirstplaybook.yml
  • 20. ● Run the playbook Command : ansible-playbook /etc/ansible/playbook/myfirstplaybook.yml
  • 21. Ansible Modules Link : All modules — Ansible Documentation