SlideShare a Scribd company logo
1 of 12
Introduction To Ansible
Kasun Madura Rathnayaka.
Senior Sys/Devops Engineer
BSc (Hons) Electrical and Information, Engineering AWS Certified
Solutions Architect Associate AMIE(SL),CCIP,RHCE,RHCSA,CCNA.ITIL
kasunmaduraeng@gmail.com skype:kasunmadura141
Continuous Integration
Teams integrate their work multiple times per day.
Each integration is verified by an automated build
Significantly reduces integration problems
Develop cohesive software more rapidly
Source: Martin Fowler
Continuous Integration
Continuous Integration and Automation Tools
● CI Tools
○ Jenkins ,Teamcity ,Buildbot, Bamboo
● Automation Tools
○ Puppet,Chef,Ansible
● Version Control
○ svn,git,perforce
● Build Tool
○ Maven,ant,grant
Ansible
What is Anible ?
Why we need Ansible ?
Advantage and Disadvantages..
Compare with Puppet and Chef
What is Ansible
● “radically simple IT automation platform”
● Describe the intended system state using playbooks written in YAML
● Requires no agent on the managed machine, only a Python interpreter and an
SSH server
Shell Script
● #!/bin/bash
● echo "fs.file-max=20000" | sudo tee -a /etc/sysclt.conf
● sudo apt-get -y install build-essential
● sudo mkdir -p /var/www/kasun
● sudo apt-get -y install apache2
● sudo a2enmod rewrite
● sudo tee /etc/apache2/sites-available/mysite <<ENDOFFILE
● <VirtualHost *:80>
● DocumentRoot "/var/www/kasun/"
● ServerName www.kasun.com
Ad-hoc configuration
Configuration file /etc/ansible/ansible.cfg
1st ansible command :)
$ cat >hosts [webservers] 192.168.1.40 ^D
$ ansible -vvv all -i hosts -u root -m ping
$ ansible -vvv webserver -i hosts -u root -m apt -a 'name=cowsay state=present'
$ ssh 192.169.1.40 cowsay moo
Playbooks
Consolidate tasks and configuration knobs into a single YAML file
Support templating—both in playbooks and in file templates—by way of Jinja2
Can be one file, or split up into many roles (more later!)
Running a playbook
• ansible-playbook playbook.yml
• -i to specify a local inventory file (e.g. hosts)
• -k if you have to enter a password for this run
• Use authorized_key to install an SSH key for future runs
Real Example
Get the ball rolling :)
Discussion
Quiz

More Related Content

What's hot

What's hot (20)

Ansible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupAnsible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL Meetup
 
How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation Easy
 
DevOps with Ansible
DevOps with AnsibleDevOps with Ansible
DevOps with Ansible
 
Provisioning your Environment with Vagrant and Ansible
Provisioning your Environment with Vagrant and AnsibleProvisioning your Environment with Vagrant and Ansible
Provisioning your Environment with Vagrant and Ansible
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with Ansible
 
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
 
Monitor-Driven Development Using Ansible
Monitor-Driven Development Using AnsibleMonitor-Driven Development Using Ansible
Monitor-Driven Development Using Ansible
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Ansible Intro - June 2015 / Ansible Barcelona User Group
Ansible Intro - June 2015 / Ansible Barcelona User GroupAnsible Intro - June 2015 / Ansible Barcelona User Group
Ansible Intro - June 2015 / Ansible Barcelona User Group
 
CI/CD Using Ansible and Jenkins for Infrastructure
CI/CD Using Ansible and Jenkins for InfrastructureCI/CD Using Ansible and Jenkins for Infrastructure
CI/CD Using Ansible and Jenkins for Infrastructure
 
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerTesting Ansible with Jenkins and Docker
Testing Ansible with Jenkins and Docker
 
Hands on ansible
Hands on ansibleHands on ansible
Hands on ansible
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Accelerating with Ansible
Accelerating with AnsibleAccelerating with Ansible
Accelerating with Ansible
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & Ansible
 
Ansible
AnsibleAnsible
Ansible
 
Ansible + WordPress
Ansible + WordPressAnsible + WordPress
Ansible + WordPress
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchAnsible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps Match
 

Viewers also liked

Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
mohamedmoharam
 

Viewers also liked (9)

Ansible
AnsibleAnsible
Ansible
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 

Similar to Introduction to ansible

Building An Automated Infrastructure
Building An Automated InfrastructureBuilding An Automated Infrastructure
Building An Automated Infrastructure
elliando dias
 
Building Automated Infrastructures
Building Automated InfrastructuresBuilding Automated Infrastructures
Building Automated Infrastructures
elliando dias
 
Why Your Start Up Needs An Automated Infrastructure Presentation
Why Your Start Up Needs An Automated Infrastructure PresentationWhy Your Start Up Needs An Automated Infrastructure Presentation
Why Your Start Up Needs An Automated Infrastructure Presentation
elliando dias
 
Continuous Delivery in the Cloud
Continuous Delivery in the CloudContinuous Delivery in the Cloud
Continuous Delivery in the Cloud
Fabio Lessa
 

Similar to Introduction to ansible (20)

Building An Automated Infrastructure
Building An Automated InfrastructureBuilding An Automated Infrastructure
Building An Automated Infrastructure
 
Building Automated Infrastructures
Building Automated InfrastructuresBuilding Automated Infrastructures
Building Automated Infrastructures
 
Ansible: Automation Tool
Ansible: Automation ToolAnsible: Automation Tool
Ansible: Automation Tool
 
Why Your Start Up Needs An Automated Infrastructure Presentation
Why Your Start Up Needs An Automated Infrastructure PresentationWhy Your Start Up Needs An Automated Infrastructure Presentation
Why Your Start Up Needs An Automated Infrastructure Presentation
 
Why Startups Need Automated Infrastructures
Why Startups Need Automated InfrastructuresWhy Startups Need Automated Infrastructures
Why Startups Need Automated Infrastructures
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
Vijay_Teekinavar_Kallesh
Vijay_Teekinavar_KalleshVijay_Teekinavar_Kallesh
Vijay_Teekinavar_Kallesh
 
Automation for cloud
Automation for cloudAutomation for cloud
Automation for cloud
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansible
 
Serverless java
Serverless   javaServerless   java
Serverless java
 
TechWiseTV Workshop: Open NX-OS and Devops with Puppet Labs
TechWiseTV Workshop: Open NX-OS and Devops with Puppet LabsTechWiseTV Workshop: Open NX-OS and Devops with Puppet Labs
TechWiseTV Workshop: Open NX-OS and Devops with Puppet Labs
 
Deep Dive into Event Driven Architecture(Async API)
Deep Dive into Event Driven Architecture(Async API)Deep Dive into Event Driven Architecture(Async API)
Deep Dive into Event Driven Architecture(Async API)
 
Rundown of Async/Await in Rust
Rundown of Async/Await in RustRundown of Async/Await in Rust
Rundown of Async/Await in Rust
 
Life as a SRE at Instana
Life as a SRE at InstanaLife as a SRE at Instana
Life as a SRE at Instana
 
Continuous Delivery in the AWS Cloud
Continuous Delivery in the AWS CloudContinuous Delivery in the AWS Cloud
Continuous Delivery in the AWS Cloud
 
Continuous Delivery in the Cloud
Continuous Delivery in the CloudContinuous Delivery in the Cloud
Continuous Delivery in the Cloud
 
Ansible for Enterprise
Ansible for EnterpriseAnsible for Enterprise
Ansible for Enterprise
 
ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
A tale in automation (Puppet to Ansible)
A tale in automation (Puppet to Ansible)A tale in automation (Puppet to Ansible)
A tale in automation (Puppet to Ansible)
 
Infrastructure Automation
Infrastructure Automation Infrastructure Automation
Infrastructure Automation
 

Recently uploaded

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 

Recently uploaded (20)

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 

Introduction to ansible

  • 1. Introduction To Ansible Kasun Madura Rathnayaka. Senior Sys/Devops Engineer BSc (Hons) Electrical and Information, Engineering AWS Certified Solutions Architect Associate AMIE(SL),CCIP,RHCE,RHCSA,CCNA.ITIL kasunmaduraeng@gmail.com skype:kasunmadura141
  • 2. Continuous Integration Teams integrate their work multiple times per day. Each integration is verified by an automated build Significantly reduces integration problems Develop cohesive software more rapidly Source: Martin Fowler
  • 4. Continuous Integration and Automation Tools ● CI Tools ○ Jenkins ,Teamcity ,Buildbot, Bamboo ● Automation Tools ○ Puppet,Chef,Ansible ● Version Control ○ svn,git,perforce ● Build Tool ○ Maven,ant,grant
  • 5. Ansible What is Anible ? Why we need Ansible ? Advantage and Disadvantages.. Compare with Puppet and Chef
  • 6. What is Ansible ● “radically simple IT automation platform” ● Describe the intended system state using playbooks written in YAML ● Requires no agent on the managed machine, only a Python interpreter and an SSH server
  • 7. Shell Script ● #!/bin/bash ● echo "fs.file-max=20000" | sudo tee -a /etc/sysclt.conf ● sudo apt-get -y install build-essential ● sudo mkdir -p /var/www/kasun ● sudo apt-get -y install apache2 ● sudo a2enmod rewrite ● sudo tee /etc/apache2/sites-available/mysite <<ENDOFFILE ● <VirtualHost *:80> ● DocumentRoot "/var/www/kasun/" ● ServerName www.kasun.com
  • 8. Ad-hoc configuration Configuration file /etc/ansible/ansible.cfg 1st ansible command :) $ cat >hosts [webservers] 192.168.1.40 ^D $ ansible -vvv all -i hosts -u root -m ping $ ansible -vvv webserver -i hosts -u root -m apt -a 'name=cowsay state=present' $ ssh 192.169.1.40 cowsay moo
  • 9. Playbooks Consolidate tasks and configuration knobs into a single YAML file Support templating—both in playbooks and in file templates—by way of Jinja2 Can be one file, or split up into many roles (more later!)
  • 10. Running a playbook • ansible-playbook playbook.yml • -i to specify a local inventory file (e.g. hosts) • -k if you have to enter a password for this run • Use authorized_key to install an SSH key for future runs
  • 11. Real Example Get the ball rolling :)