SlideShare une entreprise Scribd logo
1  sur  30
 DevOps - a clipped compound of "development" and "operations"
 Automate the software integration, testing, deployment, and infrastructure
changes.
 Improve automation and measurement of system metrics.
 The best powerful automation tool which can help us in achieving everything is
ANSIBLE.
 Basics of Ansible
 Usage of Ansible
 Ansible without playbook i.e. through Adhoc commands
 Ansible with playbook
 Ansible modules
 Installation of a package on multiple instances followed by a Demo.
It is an IT automation tool which can configure systems, deploy
software, and orchestrate more advanced IT tasks such as
continuous deployments or zero downtime rolling updates.
 Ansible is an agent-less and uses a PUSH(SSH) approach.
 It is developed by RedHat.
 It is an OpenSource application.
 Platforms supported are Linux & Windows.
 Linux for control machine & Windows for managed nodes.
 Latest version of ansible is 2.3
Reference URL : https://github.com/ansible/ansible/releases
 Major companies using Ansible are Atlassian, CISCO, EA Sports, NASA, RedHat,
Twitter and many more.
Control Machine Requirements
 Currently Ansible can be run from any machine with Python 2.6 or 2.7 installed
Managed Node Requirements(Target Host)
 On the managed nodes, you need a way to communicate, which is normally SSH.
You also need Python 2.6 or later installed for the same.
Chef/Puppet Ansible
• Needs to be installed on Agents.
• Agents pull changes from a master.
• Communication channel used is their own
(usually not SSH)
• Complicated
setup/architecture/installation
• Complicated orchestration.
• Chef uses Ruby in backend and pure Ruby
DSL for configuration.
• Puppet using Ruby in backend and uses
Puppet DSL for configuration.
• Need not be installed on Agents.
• Pushes the changes to Agents whenever
required.
• Uses SSH
• Easy installation and architecture
• Simplified orchestration.
• Ansible backed is on Python.
• Uses YAML as configuration files.
 Installing Ansible on CentOS :
 To get Ansible for CentOS 7, first ensure that the CentOS 7 EPEL repository is
installed:
sudo yum install epel-release
sudo yum update
 Once the repository is installed, install Ansible with yum:
sudo yum install ansible
 Installing Ansible on Ubuntu :
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
 Run command : ansible –version
 Example output :
ansible 2.3.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
NOTE : If anyone wants to execute the playbook on a remote machine
then it is mandatory to have Python libraries installed on that remote machine.
 Certain settings in Ansible are adjustable via a configuration file. This
configuration file is know as ANSIBLE CONFIG
 Ansible allows configuration of settings via environment variables. If these
environment variables are set, they will override any setting loaded from the
configuration file.
 Here is the order in which configuration file will be processed.
 We use YAML because it is easier for humans to read and write than other common data formats like XML or JSON.
 All YAML files (regardless of their association with Ansible or not) can optionally begin with --- and end with ... This is part of the YAML
format and indicates the start and end of a document.
 All members of a list are lines beginning at the same indentation level starting with a "- " (a dash and a space):
Example :
---
# A list of tasty fruits
fruits:
- Apple
- Orange
- Strawberry
- Mango
…
 A dictionary is represented in a simple key: value form (the colon must be followed by a space):
Example :
# An employee record
martin:
name: Martin D'vloper
job: Developer
skill: Elite
 Ansible works against multiple systems in our infrastructure at a particular point
of time.
 It does this by selecting portions of systems listed in Ansible’s inventory which
defaults to being saved at the location : /etc/ansible/hosts.
 You can specify a different inventory file using the -i <path> option on the
command line
 Example : ansible-playbook -i playbook.yml
 It can be used in both commands & playbooks.
 Types of inventories includes basic list, shell script, python script, advanced script
like ec2,etc.
 To ping multiple servers at a time(which are existing in inventory file) :
 ansible –m ping all
 For creating a new user and manipulation of existing user accounts :
 ansible all -m user -a "name=foo password=<crypted password here>”
 Ensure a service is started on all webservers:
 ansible webservers -m service -a "name=httpd state=started"
 Ansible adhoc commands have the limitation in complex scenarios so to overcome
this and make the automation easy & robust, playbooks were introduced.
 Playbooks can be used to manage configurations and deployments to remote
machines.
 Here is the example how to use a playbook.
 ansible-playbook first.yml –e name=webservers1
 apt module
 yum module
 package module
 shell module
 command module
 user module
 hostname module
 The apt module manages the apt packages.
Example :
- name: Remove "foo" package.
apt:
name: foo
state: absent
- name: Install the package "foo"
apt:
name: foo
state: present
 Installs, upgrade, removes, and lists packages and groups with the yum package
manager.
Example :
- name: install the latest version of Apache
yum:
name: httpd
state: latest
 Installs, upgrade and removes packages using the underlying OS package
manager.
Example :
- name: install the latest version of ntpdate
package:
name: ntpdate
state: latest
 The shell module takes the command name followed by a list of space-delimited
arguments. It is almost exactly like the command module but runs the command
through a shell (/bin/sh) on the remote node.
Example :
- name: Executing a Command Using Shell Module
shell: ls -lrt > temp.txt
The above command lists all the files in the current folder and writes that to the file i.e.
temp.txt.
 The command module takes the command name followed by a list of space-
delimited arguments.
 The given command will be executed on all selected nodes. It will not be processed
through the shell, so variables like $HOME and operations
like "<", ">", "|", ";" and "&" will not work.
Example :
- name: Executing a command using command module.
command: cat hello.txt
The above command displays the content of the file hello.txt
 Manage user accounts and user attributes.
Example :
- user:
name: johnd
comment: "John Doe"
uid: 1040
group: admin
 Set system’s hostname, supports most OSs/Distributions, including those using
systemd.
 Note, this module does NOT modify /etc/hosts. You need to modify it yourself using
other modules like template or replace.
Example :
- hostname:
name: web01
 Ansible command using a direct agent.
 Ansible command using an Inventory group.
 Ansible playbook for direct host (agent)
 Ansible playbook split into multiple tasks.
 Ansible playbook installing a service on multiple hosts.
Basics of Ansible - Sahil Davawala

Contenu connexe

Tendances

Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Richard Donkin
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to AnsibleCédric Delgehier
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = CodeGeorg Sorst
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshopDavid Karban
 
Ansible Introduction - Ansible Brno #1 - David Karban
Ansible Introduction - Ansible Brno #1 - David KarbanAnsible Introduction - Ansible Brno #1 - David Karban
Ansible Introduction - Ansible Brno #1 - David Karbanansiblebrno
 
Ansible on aws - Pop-up Loft Tel Aviv
Ansible on aws - Pop-up Loft Tel AvivAnsible on aws - Pop-up Loft Tel Aviv
Ansible on aws - Pop-up Loft Tel AvivAmazon Web Services
 
Managing Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with AnsibleManaging Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with Ansiblefmaccioni
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Ansible + WordPress - WordCamp Toronto 2016
Ansible + WordPress - WordCamp Toronto 2016Ansible + WordPress - WordCamp Toronto 2016
Ansible + WordPress - WordCamp Toronto 2016Alan Lok
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017Jumping Bean
 
20명 규모의 팀에서 Vault 사용하기
20명 규모의 팀에서 Vault 사용하기20명 규모의 팀에서 Vault 사용하기
20명 규모의 팀에서 Vault 사용하기Doyoon Kim
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleDharmit Shah
 
Breaking Up With Your Data Center Presentation
Breaking Up With Your Data Center PresentationBreaking Up With Your Data Center Presentation
Breaking Up With Your Data Center PresentationTelescope_Inc
 

Tendances (20)

Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Ansible best practices
Ansible best practicesAnsible best practices
Ansible best practices
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshop
 
Ansible Introduction - Ansible Brno #1 - David Karban
Ansible Introduction - Ansible Brno #1 - David KarbanAnsible Introduction - Ansible Brno #1 - David Karban
Ansible Introduction - Ansible Brno #1 - David Karban
 
Ansible on aws - Pop-up Loft Tel Aviv
Ansible on aws - Pop-up Loft Tel AvivAnsible on aws - Pop-up Loft Tel Aviv
Ansible on aws - Pop-up Loft Tel Aviv
 
Managing Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with AnsibleManaging Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with Ansible
 
Ansible container
Ansible containerAnsible container
Ansible container
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Ansible + WordPress - WordCamp Toronto 2016
Ansible + WordPress - WordCamp Toronto 2016Ansible + WordPress - WordCamp Toronto 2016
Ansible + WordPress - WordCamp Toronto 2016
 
Ansible testing
Ansible   testingAnsible   testing
Ansible testing
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
 
20명 규모의 팀에서 Vault 사용하기
20명 규모의 팀에서 Vault 사용하기20명 규모의 팀에서 Vault 사용하기
20명 규모의 팀에서 Vault 사용하기
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Breaking Up With Your Data Center Presentation
Breaking Up With Your Data Center PresentationBreaking Up With Your Data Center Presentation
Breaking Up With Your Data Center Presentation
 

Similaire à Basics of Ansible - Sahil Davawala

Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modulesmohamedmoharam
 
Ansible a tool for dev ops
Ansible a tool for dev opsAnsible a tool for dev ops
Ansible a tool for dev opsRené Ribaud
 
Ansible Network Automation session1
Ansible Network Automation session1Ansible Network Automation session1
Ansible Network Automation session1Dhruv Sharma
 
Intro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupIntro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupRamesh Godishela
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2Fernando Lopez Aguilar
 
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabHow to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabFIWARE
 
Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015Alex S
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linuxnejadmand
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonMyNOG
 

Similaire à Basics of Ansible - Sahil Davawala (20)

Ansible_Basics_ppt.pdf
Ansible_Basics_ppt.pdfAnsible_Basics_ppt.pdf
Ansible_Basics_ppt.pdf
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
 
Ansible a tool for dev ops
Ansible a tool for dev opsAnsible a tool for dev ops
Ansible a tool for dev ops
 
Ansible Network Automation session1
Ansible Network Automation session1Ansible Network Automation session1
Ansible Network Automation session1
 
Ansible
AnsibleAnsible
Ansible
 
Intro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupIntro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetup
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Ansible
AnsibleAnsible
Ansible
 
Installing AtoM with Ansible
Installing AtoM with AnsibleInstalling AtoM with Ansible
Installing AtoM with Ansible
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2
 
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabHow to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
 
Ansible Hands On
Ansible Hands OnAnsible Hands On
Ansible Hands On
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015
 
ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linux
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent Boon
 

Dernier

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 

Dernier (20)

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 

Basics of Ansible - Sahil Davawala

  • 1.
  • 2.  DevOps - a clipped compound of "development" and "operations"  Automate the software integration, testing, deployment, and infrastructure changes.  Improve automation and measurement of system metrics.  The best powerful automation tool which can help us in achieving everything is ANSIBLE.
  • 3.
  • 4.  Basics of Ansible  Usage of Ansible  Ansible without playbook i.e. through Adhoc commands  Ansible with playbook  Ansible modules  Installation of a package on multiple instances followed by a Demo.
  • 5. It is an IT automation tool which can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates.
  • 6.  Ansible is an agent-less and uses a PUSH(SSH) approach.  It is developed by RedHat.  It is an OpenSource application.  Platforms supported are Linux & Windows.  Linux for control machine & Windows for managed nodes.  Latest version of ansible is 2.3 Reference URL : https://github.com/ansible/ansible/releases  Major companies using Ansible are Atlassian, CISCO, EA Sports, NASA, RedHat, Twitter and many more.
  • 7. Control Machine Requirements  Currently Ansible can be run from any machine with Python 2.6 or 2.7 installed Managed Node Requirements(Target Host)  On the managed nodes, you need a way to communicate, which is normally SSH. You also need Python 2.6 or later installed for the same.
  • 8.
  • 9. Chef/Puppet Ansible • Needs to be installed on Agents. • Agents pull changes from a master. • Communication channel used is their own (usually not SSH) • Complicated setup/architecture/installation • Complicated orchestration. • Chef uses Ruby in backend and pure Ruby DSL for configuration. • Puppet using Ruby in backend and uses Puppet DSL for configuration. • Need not be installed on Agents. • Pushes the changes to Agents whenever required. • Uses SSH • Easy installation and architecture • Simplified orchestration. • Ansible backed is on Python. • Uses YAML as configuration files.
  • 10.  Installing Ansible on CentOS :  To get Ansible for CentOS 7, first ensure that the CentOS 7 EPEL repository is installed: sudo yum install epel-release sudo yum update  Once the repository is installed, install Ansible with yum: sudo yum install ansible  Installing Ansible on Ubuntu : sudo apt-get install software-properties-common sudo apt-add-repository ppa:ansible/ansible sudo apt-get update sudo apt-get install ansible
  • 11.  Run command : ansible –version  Example output : ansible 2.3.1.0 config file = /etc/ansible/ansible.cfg configured module search path = Default w/o overrides NOTE : If anyone wants to execute the playbook on a remote machine then it is mandatory to have Python libraries installed on that remote machine.
  • 12.  Certain settings in Ansible are adjustable via a configuration file. This configuration file is know as ANSIBLE CONFIG  Ansible allows configuration of settings via environment variables. If these environment variables are set, they will override any setting loaded from the configuration file.  Here is the order in which configuration file will be processed.
  • 13.  We use YAML because it is easier for humans to read and write than other common data formats like XML or JSON.  All YAML files (regardless of their association with Ansible or not) can optionally begin with --- and end with ... This is part of the YAML format and indicates the start and end of a document.  All members of a list are lines beginning at the same indentation level starting with a "- " (a dash and a space): Example : --- # A list of tasty fruits fruits: - Apple - Orange - Strawberry - Mango …  A dictionary is represented in a simple key: value form (the colon must be followed by a space): Example : # An employee record martin: name: Martin D'vloper job: Developer skill: Elite
  • 14.
  • 15.  Ansible works against multiple systems in our infrastructure at a particular point of time.  It does this by selecting portions of systems listed in Ansible’s inventory which defaults to being saved at the location : /etc/ansible/hosts.  You can specify a different inventory file using the -i <path> option on the command line  Example : ansible-playbook -i playbook.yml  It can be used in both commands & playbooks.  Types of inventories includes basic list, shell script, python script, advanced script like ec2,etc.
  • 16.
  • 17.  To ping multiple servers at a time(which are existing in inventory file) :  ansible –m ping all  For creating a new user and manipulation of existing user accounts :  ansible all -m user -a "name=foo password=<crypted password here>”  Ensure a service is started on all webservers:  ansible webservers -m service -a "name=httpd state=started"
  • 18.  Ansible adhoc commands have the limitation in complex scenarios so to overcome this and make the automation easy & robust, playbooks were introduced.  Playbooks can be used to manage configurations and deployments to remote machines.  Here is the example how to use a playbook.  ansible-playbook first.yml –e name=webservers1
  • 19.
  • 20.  apt module  yum module  package module  shell module  command module  user module  hostname module
  • 21.  The apt module manages the apt packages. Example : - name: Remove "foo" package. apt: name: foo state: absent - name: Install the package "foo" apt: name: foo state: present
  • 22.  Installs, upgrade, removes, and lists packages and groups with the yum package manager. Example : - name: install the latest version of Apache yum: name: httpd state: latest
  • 23.  Installs, upgrade and removes packages using the underlying OS package manager. Example : - name: install the latest version of ntpdate package: name: ntpdate state: latest
  • 24.  The shell module takes the command name followed by a list of space-delimited arguments. It is almost exactly like the command module but runs the command through a shell (/bin/sh) on the remote node. Example : - name: Executing a Command Using Shell Module shell: ls -lrt > temp.txt The above command lists all the files in the current folder and writes that to the file i.e. temp.txt.
  • 25.  The command module takes the command name followed by a list of space- delimited arguments.  The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like $HOME and operations like "<", ">", "|", ";" and "&" will not work. Example : - name: Executing a command using command module. command: cat hello.txt The above command displays the content of the file hello.txt
  • 26.  Manage user accounts and user attributes. Example : - user: name: johnd comment: "John Doe" uid: 1040 group: admin
  • 27.  Set system’s hostname, supports most OSs/Distributions, including those using systemd.  Note, this module does NOT modify /etc/hosts. You need to modify it yourself using other modules like template or replace. Example : - hostname: name: web01
  • 28.
  • 29.  Ansible command using a direct agent.  Ansible command using an Inventory group.  Ansible playbook for direct host (agent)  Ansible playbook split into multiple tasks.  Ansible playbook installing a service on multiple hosts.

Notes de l'éditeur

  1. DevOps (a clipped compound of "development" and "operations") is a software development and delivery process that emphasizes communication and collaboration between product management, software development, and operations professionals.  It seeks to automate the process of software integration, testing, deployment, and infrastructure changes by establishing a culture and environment where building, testing, and releasing software can happen rapidly, frequently, and more reliably.
  2. And ofcourse Crest Data Systems is one of the major companies.
  3. For Windows : Need pywinrm on control machine(Linux) Need PowerShell on the target machine(Windows)
  4. Change Management - Provisioning - Automation - Orchestration - It basically means the automated arrangement, coordination, and management of complex computer systems, and services.
  5. https://www.ansible.com/blog/orchestration-you-keep-using-that-word
  6. Playbooks - Playbooks are Ansible’s configuration, deployment, and orchestration language. Playbooks are designed to be human-readable and are developed in a basic text language.
  7. And many more…. Ansible is famous because of N number of modules support they provide.
  8. RPM family(Linux,CentOS) : Httpd Debian family(Ubuntu) : Apache Reference URL(using package module on multiple OS) : https://serverfault.com/questions/587727/how-to-unify-package-installation-tasks-in-ansible
  9. Commands : ansible -m ping all ansible-playbook first.yml -e name=webservers1