SlideShare a Scribd company logo
1 of 9
Download to read offline
ANSIBLE Santhosh Kumar
MCSE|CCNA|VCP|CISA
AGENDA
Why use Ansible
History of Ansible
Important terms used in Ansible
Ansible Installation in Linux
Ansible ad-hoc commands
Ansible Playbooks
Ansible Roles
Case Study
Ansible Commands Cheat Sheet
WHY USE
ANSIBLE
Here are some important pros/benefits of using Ansible
One of the most significant advantages of Ansible is that it is free to
use by everyone.
It does not need any special system administrator skills to install and
use Ansible, and the official documentation is very comprehensive.
Its modularity regarding plugins, modules, inventories, and playbooks
make Ansible the perfect companion to orchestrate large
environments.
Ansible is very lightweight and consistent, and no constraints regarding
the operating system or underlying hardware are present.
It is also very secure due to its agentless capabilities and due to the
use of OpenSSH security features.
Another advantage that encourages the adoption of Ansible is its
smooth learning curve determined by the comprehensive
documentation and easy to learn structure and configuration
HISTORY OF ANSIBLE
In February 2012 the
Ansible project began. It
was first developed by
Michael DeHaan, the
creator of Cobbler and
Func, Fedora Unified
Network Controller.
01
Initially called AnsibleWorks
Inc, the company funding the
ansible tool was acquired in
2015 by RedHat and later
on, along with RedHat,
moved under the umbrella
of IBM.
02
In the present, Ansible comes
included in distributions like
Fedora Linux, RHEL, Centos
and Oracle Linux
03
IMPORTANT
TERMS USED IN
ANSIBLE
Ansible server:
The machine where Ansible is installed and from which all tasks and playbooks will be ran
Module:
Basically, a module is a command or set of similar commands meant to be executed on the client-side
Task:
A task is a section that consists of a single procedure to be completed
Role:
A way of organizing tasks and related files to be later called in a playbook
Fact:
Information fetched from the client system from the global variables with the gather-facts operation
Inventory:
File containing data about the ansible client servers. Defined in later examples as hosts file
Play:
Execution of a playbook
Handler:
Task which is called only if a notifier is present
Notifier:
Section attributed to a task which calls a handler if the output is changed
Tag:
Name set to a task which can be used later on to issue just that specific task or group of tasks
ANSIBLE INSTALLATION IN LINUX
Once you have compared and weighed your options and
decided to go for Ansible, the next step is to have it installed on
your system. We will go through the steps of installation in
different Linux distributions, the most popular ones, in the next
small Demo
Step 1) Install EPEL repo
[root@ansible-server ~]# sudo yum install epel-release
Step 2) Install ansible package
[root@ansible-server ~]# sudo yum install -y ansible
ANSIBLE AD-HOC COMMANDS
One of the simplest ways Ansible can be used is by using ad-hoc commands. These can be used when you want
to issue some commands on a server or a bunch of servers. Ad-hoc commands are not stored for future uses but
represent a fast way to interact with the desired servers.
[root@ansible-server test_ansible]# ansible -i hosts all -m ping
host1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
host2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
EXAMPLE
Explanation:
Status of the
command, in this case,
SUCCESS
Host on which the
command ran
The command issued
via the -m parameter,
in this case, ping
With the -i parameter,
you can point to the
hosts file.
THANK YOU
TECADE MANAGED INC

More Related Content

What's hot

Awx user guide
Awx user guideAwx user guide
Awx user guidemspirko
 
DevOps 2015 - Dancing with Chef
DevOps 2015 - Dancing with ChefDevOps 2015 - Dancing with Chef
DevOps 2015 - Dancing with Chefsmalltown
 
Short journey into the serverless world
Short journey into the serverless worldShort journey into the serverless world
Short journey into the serverless worldScott van Kalken
 
Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)Nati Shalom
 
Automating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleAutomating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleBrian Hogan
 
JBoss Developer Webinar: Cloud: BoxGrinder & SteamCannon
JBoss Developer Webinar: Cloud: BoxGrinder & SteamCannonJBoss Developer Webinar: Cloud: BoxGrinder & SteamCannon
JBoss Developer Webinar: Cloud: BoxGrinder & SteamCannonbobmcwhirter
 
Immutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and TerraformImmutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and TerraformMichael Peacock
 
JUDCon 2010 Boston : CoolingTower and CirrAS
JUDCon 2010 Boston : CoolingTower and CirrASJUDCon 2010 Boston : CoolingTower and CirrAS
JUDCon 2010 Boston : CoolingTower and CirrASmarekgoldmann
 
Packer, Terraform, Ansible avec Azure
Packer, Terraform, Ansible avec AzurePacker, Terraform, Ansible avec Azure
Packer, Terraform, Ansible avec AzureAZUG FR
 
MDP Group SAP PI & PO Azure Adapter
MDP Group SAP PI & PO Azure AdapterMDP Group SAP PI & PO Azure Adapter
MDP Group SAP PI & PO Azure AdapterMDP Group
 
Chef - Infrastructure Automation for the Masses
Chef - Infrastructure Automation for the Masses�Chef - Infrastructure Automation for the Masses�
Chef - Infrastructure Automation for the MassesSai Perchard
 
Spinnaker for Azure
Spinnaker for AzureSpinnaker for Azure
Spinnaker for AzureLarry Guger
 
Productive OpenCL with Intel Xeon Phi Coprocessors
Productive OpenCL with Intel Xeon Phi CoprocessorsProductive OpenCL with Intel Xeon Phi Coprocessors
Productive OpenCL with Intel Xeon Phi CoprocessorsIntel IT Center
 
iSCSI for better or worse
iSCSI for better or worseiSCSI for better or worse
iSCSI for better or worseSteven Aiello
 
AWS IoT with ESP32 and Mongoose OS
AWS IoT with ESP32 and Mongoose OSAWS IoT with ESP32 and Mongoose OS
AWS IoT with ESP32 and Mongoose OSAmazon Web Services
 
Unikernels and Cloud Computing
Unikernels and Cloud ComputingUnikernels and Cloud Computing
Unikernels and Cloud ComputingSKORDEMIR
 

What's hot (20)

Awx user guide
Awx user guideAwx user guide
Awx user guide
 
Quantum basic VLAN plugin
Quantum basic VLAN pluginQuantum basic VLAN plugin
Quantum basic VLAN plugin
 
DevOps 2015 - Dancing with Chef
DevOps 2015 - Dancing with ChefDevOps 2015 - Dancing with Chef
DevOps 2015 - Dancing with Chef
 
Short journey into the serverless world
Short journey into the serverless worldShort journey into the serverless world
Short journey into the serverless world
 
Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)
 
Automating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleAutomating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and Ansible
 
Linux kickstart
Linux kickstartLinux kickstart
Linux kickstart
 
Ansible Playbook
Ansible PlaybookAnsible Playbook
Ansible Playbook
 
JBoss Developer Webinar: Cloud: BoxGrinder & SteamCannon
JBoss Developer Webinar: Cloud: BoxGrinder & SteamCannonJBoss Developer Webinar: Cloud: BoxGrinder & SteamCannon
JBoss Developer Webinar: Cloud: BoxGrinder & SteamCannon
 
Immutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and TerraformImmutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and Terraform
 
JUDCon 2010 Boston : CoolingTower and CirrAS
JUDCon 2010 Boston : CoolingTower and CirrASJUDCon 2010 Boston : CoolingTower and CirrAS
JUDCon 2010 Boston : CoolingTower and CirrAS
 
Packer, Terraform, Ansible avec Azure
Packer, Terraform, Ansible avec AzurePacker, Terraform, Ansible avec Azure
Packer, Terraform, Ansible avec Azure
 
MDP Group SAP PI & PO Azure Adapter
MDP Group SAP PI & PO Azure AdapterMDP Group SAP PI & PO Azure Adapter
MDP Group SAP PI & PO Azure Adapter
 
Chef - Infrastructure Automation for the Masses
Chef - Infrastructure Automation for the Masses�Chef - Infrastructure Automation for the Masses�
Chef - Infrastructure Automation for the Masses
 
Ansible in CI
Ansible in CIAnsible in CI
Ansible in CI
 
Spinnaker for Azure
Spinnaker for AzureSpinnaker for Azure
Spinnaker for Azure
 
Productive OpenCL with Intel Xeon Phi Coprocessors
Productive OpenCL with Intel Xeon Phi CoprocessorsProductive OpenCL with Intel Xeon Phi Coprocessors
Productive OpenCL with Intel Xeon Phi Coprocessors
 
iSCSI for better or worse
iSCSI for better or worseiSCSI for better or worse
iSCSI for better or worse
 
AWS IoT with ESP32 and Mongoose OS
AWS IoT with ESP32 and Mongoose OSAWS IoT with ESP32 and Mongoose OS
AWS IoT with ESP32 and Mongoose OS
 
Unikernels and Cloud Computing
Unikernels and Cloud ComputingUnikernels and Cloud Computing
Unikernels and Cloud Computing
 

Similar to Ansible Playbook Cheat Sheet for Linux Server Automation

Basics of Ansible - Sahil Davawala
Basics of Ansible - Sahil DavawalaBasics of Ansible - Sahil Davawala
Basics of Ansible - Sahil DavawalaSahil Davawala
 
UNIT-I Introduction to Ansible.pptx
UNIT-I Introduction to Ansible.pptxUNIT-I Introduction to Ansible.pptx
UNIT-I Introduction to Ansible.pptxPandiya Rajan
 
Ansible day 1.ppt
Ansible day 1.pptAnsible day 1.ppt
Ansible day 1.pptKalkey
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
Security workflow with ansible
Security  workflow with ansibleSecurity  workflow with ansible
Security workflow with ansibledevanshdubey7
 
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...SlideTeam
 
Top 50 Ansible Interview Questions And Answers in 2023.pdf
Top 50 Ansible Interview Questions And Answers in 2023.pdfTop 50 Ansible Interview Questions And Answers in 2023.pdf
Top 50 Ansible Interview Questions And Answers in 2023.pdfDatacademy.ai
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleCoreStack
 
DevOps Training | DevOps Online Training
DevOps Training | DevOps Online TrainingDevOps Training | DevOps Online Training
DevOps Training | DevOps Online TrainingVisualpath Training
 
Linux Operating SystemMigration ProposalCMIT 391 - Section .docx
Linux Operating SystemMigration ProposalCMIT 391 -  Section .docxLinux Operating SystemMigration ProposalCMIT 391 -  Section .docx
Linux Operating SystemMigration ProposalCMIT 391 - Section .docxwashingtonrosy
 
Ansible: Simple yet powerful IT automation tool
Ansible: Simple yet powerful IT automation toolAnsible: Simple yet powerful IT automation tool
Ansible: Simple yet powerful IT automation toolsureshraj43
 

Similar to Ansible Playbook Cheat Sheet for Linux Server Automation (20)

Ansible day01
Ansible day01Ansible day01
Ansible day01
 
Basics of Ansible - Sahil Davawala
Basics of Ansible - Sahil DavawalaBasics of Ansible - Sahil Davawala
Basics of Ansible - Sahil Davawala
 
UNIT-I Introduction to Ansible.pptx
UNIT-I Introduction to Ansible.pptxUNIT-I Introduction to Ansible.pptx
UNIT-I Introduction to Ansible.pptx
 
ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
Ansible day 1.ppt
Ansible day 1.pptAnsible day 1.ppt
Ansible day 1.ppt
 
Ansible day 1.ppt
Ansible day 1.pptAnsible day 1.ppt
Ansible day 1.ppt
 
Ansible.pdf
Ansible.pdfAnsible.pdf
Ansible.pdf
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible
AnsibleAnsible
Ansible
 
Security workflow with ansible
Security  workflow with ansibleSecurity  workflow with ansible
Security workflow with ansible
 
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
 
Top 50 Ansible Interview Questions And Answers in 2023.pdf
Top 50 Ansible Interview Questions And Answers in 2023.pdfTop 50 Ansible Interview Questions And Answers in 2023.pdf
Top 50 Ansible Interview Questions And Answers in 2023.pdf
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
DevOps Training | DevOps Online Training
DevOps Training | DevOps Online TrainingDevOps Training | DevOps Online Training
DevOps Training | DevOps Online Training
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Linux Operating SystemMigration ProposalCMIT 391 - Section .docx
Linux Operating SystemMigration ProposalCMIT 391 -  Section .docxLinux Operating SystemMigration ProposalCMIT 391 -  Section .docx
Linux Operating SystemMigration ProposalCMIT 391 - Section .docx
 
Ansible: Simple yet powerful IT automation tool
Ansible: Simple yet powerful IT automation toolAnsible: Simple yet powerful IT automation tool
Ansible: Simple yet powerful IT automation tool
 
Ansible
AnsibleAnsible
Ansible
 

Recently uploaded

ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 

Recently uploaded (20)

ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 

Ansible Playbook Cheat Sheet for Linux Server Automation

  • 2. AGENDA Why use Ansible History of Ansible Important terms used in Ansible Ansible Installation in Linux Ansible ad-hoc commands Ansible Playbooks Ansible Roles Case Study Ansible Commands Cheat Sheet
  • 3. WHY USE ANSIBLE Here are some important pros/benefits of using Ansible One of the most significant advantages of Ansible is that it is free to use by everyone. It does not need any special system administrator skills to install and use Ansible, and the official documentation is very comprehensive. Its modularity regarding plugins, modules, inventories, and playbooks make Ansible the perfect companion to orchestrate large environments. Ansible is very lightweight and consistent, and no constraints regarding the operating system or underlying hardware are present. It is also very secure due to its agentless capabilities and due to the use of OpenSSH security features. Another advantage that encourages the adoption of Ansible is its smooth learning curve determined by the comprehensive documentation and easy to learn structure and configuration
  • 4. HISTORY OF ANSIBLE In February 2012 the Ansible project began. It was first developed by Michael DeHaan, the creator of Cobbler and Func, Fedora Unified Network Controller. 01 Initially called AnsibleWorks Inc, the company funding the ansible tool was acquired in 2015 by RedHat and later on, along with RedHat, moved under the umbrella of IBM. 02 In the present, Ansible comes included in distributions like Fedora Linux, RHEL, Centos and Oracle Linux 03
  • 5. IMPORTANT TERMS USED IN ANSIBLE Ansible server: The machine where Ansible is installed and from which all tasks and playbooks will be ran Module: Basically, a module is a command or set of similar commands meant to be executed on the client-side Task: A task is a section that consists of a single procedure to be completed Role: A way of organizing tasks and related files to be later called in a playbook Fact: Information fetched from the client system from the global variables with the gather-facts operation Inventory: File containing data about the ansible client servers. Defined in later examples as hosts file Play: Execution of a playbook Handler: Task which is called only if a notifier is present Notifier: Section attributed to a task which calls a handler if the output is changed Tag: Name set to a task which can be used later on to issue just that specific task or group of tasks
  • 6. ANSIBLE INSTALLATION IN LINUX Once you have compared and weighed your options and decided to go for Ansible, the next step is to have it installed on your system. We will go through the steps of installation in different Linux distributions, the most popular ones, in the next small Demo Step 1) Install EPEL repo [root@ansible-server ~]# sudo yum install epel-release Step 2) Install ansible package [root@ansible-server ~]# sudo yum install -y ansible
  • 7. ANSIBLE AD-HOC COMMANDS One of the simplest ways Ansible can be used is by using ad-hoc commands. These can be used when you want to issue some commands on a server or a bunch of servers. Ad-hoc commands are not stored for future uses but represent a fast way to interact with the desired servers. [root@ansible-server test_ansible]# ansible -i hosts all -m ping host1 | SUCCESS => { "changed": false, "ping": "pong" } host2 | SUCCESS => { "changed": false, "ping": "pong" }
  • 8. EXAMPLE Explanation: Status of the command, in this case, SUCCESS Host on which the command ran The command issued via the -m parameter, in this case, ping With the -i parameter, you can point to the hosts file.