SlideShare a Scribd company logo
1 of 16
Download to read offline
ANSIBLE
A TOOL FOR DEV/OPS
SESSION OBJECTIVES
Objectives
Present Ansible, a popular tool used in Dev/Ops context
The needs to automate tasks across distributed systems
Typical needs
Ansible use cases for managing Openstack
WHAT IS ANSIBLE
WHAT IS ANSIBLE
Ansible is a free software platform for configuring and managing
computers.
The platform was created by Michael DeHaan, he is the Cobbler author
as well.
THE NEED FOR AUTOMATION
TYPICAL NEEDS
As a developer/tester: during dev and test phase.
Safely Do repetitive configurations tasks on a set of VMs implementing a multi-tier cluster
Provision ssh public keys of team members on N freshly deployed nodes during dev phase
Automate a documented complex installation sequence – BTW why writing such a document ? etc
As a Sysadmin/Sysops
Automate remote scripting of many day to day tasks
Check and maintain configuration on systems, can be coupled with a revision management tool
As a Service Delivery team: efficiency
Efficient deployment of complex solutions with easily injecting customers or deal specific configuration parameters
Avoid restarting from start when you hit an error
Do it faster and cheaper and at scale
As <anyone>
Be efficient in front of the explosion of the # of entities (servers, VMs, ...) to ‘manage’
THE AVAILABLE TOOLS
ANDKEY PROPERTIES
The ‘old ways’ we all experimented: is gone
Document the pre-requisites, document the sequence of actions.
Keeping the doc up to date and tested is time consuming. Doc is subject to interpretation, ...
Shell scripting
Handling errors correctly is hard. Designing them to avoid restart from scratch is even harder
The current way: Configuration management and automation frameworks.
Puppet, Chef, Salt,
All promote idempotency
Ansible addresses most of the issues at low cost
Easy to learn and debug
Open source software (with commercial support available)
Leaves no “fingerprints” or residue on target systems
Predictable execution / Repeatable / Idempotent Mostly / Parallel operations
Ansible
ANSIBLE BASICS AND KEY CONCEPTS
ANSIBLE ARCHITECTURE AND WORKING MODEL
An ‘orchestration engine’ where Ansible SW
is installed.
No agent required. leverage ssh as default
secure transport.
Execute playbooks.
Predictable – in order execution
Designed to work in push mode to all target
hosts in parallel.
hosts can be many things:
Any Linux/*Nix systems
networking gears running sshd
Windows hosts by leverging WinRM and PowerShell
(hence no ssh in that case)
And more...
THE INVENTORY
WHERE THE HOSTS ARE REGISTERED
ABOUTINVENTORIES
Static inventory:
A file containing a set of hosts and groups of hosts.
Can also contain some host specific settings.
Common practice is to name groups per intended
function.
Dynamic inventory – hosts and groups from
external source via inventory plugin.
From a CMDB
From a cloud provider (e.g: AWS EC2/Eucalyptus,
Rackspace Cloud. OpenStack nova, gce, digital ocean ...)
Useful when hosts names are hard to predict or when
many hosts
More than one inventory and mix of static
and dynamic inventory sources is possible:
One for development, one for staging, one for production
One for public cloud one for private cloud
EXAMPLE OF ASIMPLE STATIC INVENTORY – NO DBNEEDED
# This is a comment         
# localhost refers to the ansible control node
localhost
[webservers]
www1.example.com
www2.example.com
www[10:50].example.com
[dbservers] 
db1.example.com      
db[a:f].example.com
10.0.1.9 ansible_ssh_port=2222 ansible_ssh_user=admin
[LinuxVMs]
localhost
db1.example.com
www21.example.com
ANSIBLE PLAYBOOKS - THE PLAYS
ALISTOF PLAYS TO RUN ON TARGETHOSTS
Playbooks are yaml text files containing a list
of plays and run via the ansible-playbook cli
Playbooks can be hierarchical and use
structured directory and file layout.
A play maps a set of hosts with “what to
execute” on them
Has a name: descriptive text
Start with a section specifying the set of target hosts with
the parameters to access them.
May contain variables declaration sections
Contains sections specifying “what to run” on them
A play optionally ‘gather Facts’ and makes
them available as variables. Facts are all the
information Ansible discovers about a host.
Each play is run in sequence and may specify
the account (remote_user) to be used to
connect to the remote hosts, if sudo is
needed, etc
PLAYBOOKEXTRACT– THE FIRSTSECTION OF APLAY
­ name: This is the PLAY1 title
  hosts: webservers  # this can be host, groups or complex expr
  gather_facts: True  # trigger facts discovery about targets
  remote_user tester  # connect as 'tester' account
  sudo: False         # whether to run as sudo or not
  [...skipped part...] # what to run on the targets – skipped
­ name: This is the PLAY2 Title 
  hosts: dbservers:!db1.example.com # exclude a host
  gather_facts: False
  remote_user: admin  # connect as 'admin' account
  sudo: True
  [...skipped part...] # what to run on the targets – skipped
ANSIBLE PLAYBOOKS – THE TASKS
WHATTO RUN ON TARGETHOSTS
The tasks section describes the list of actions
you want to execute on the target hosts
The tasks are run in order, one at a time,
against all the target hosts in parallel, before
moving to the next.
A task:
Has a name : descriptive text
Executes a module with specific parameters.
Reports status [ok, changed, failed, skipping] at runtime
Handlers are tasks triggered at the end of
the play if a change was made
A is a small program, generally
idempotent and that can be written in any
language *.
There are modules for many things, see the
module index. You can write your own.
Variables and templates leverage jinja2
templating engine
module
THE NTP SIMPLE EXAMPLE
­ name: Setup ntp client
  hosts: linuxVMs:!localhost # target hosts
  remote_user: tester # connect as ‘tester’ account 
  sudo: True # and need sudo capability
  vars:
    ­ time_sources: [ntp2.austin.hp.com, gpsclock0.sdd.hp.com, ntp1
    ­ ntp_rpm: ntp
  tasks:
    ­ name: Install the required  time service package
      yum: name={{ ntp_rpm }} state=installed
    ­ name: Instantiate the ntp.conf from template file
      template: src=ntp.conf.j2  dest=/etc/ntp.conf
  notify: 
    ­ restart time server daemon
    ­ name: The os are we running on
      debug: msg=“this is a {{ ansible_distribution }} {{ ansible_
  handlers:
    ­ name: restart time server daemon
      service: name=ntpd state=restarted enabled=yes
ANSIBLE ROLES
PARAMETERIZEDTASKS FORSHARINGANDREUSE
Rapidly you will need to reuse some tasks, or
abstract some consecutive tasks and give it
a name.
A role is materialized as a set of structured
files and may have:
A set of defaults (aka default values)
A tasks list
handlers
Templates files
files
meta
vars
This works like an clever include directive
Hint: browse the roles
repository and use the ansible-galaxy cli to
get them.
Openstack playbooks :
Ansible Galaxy
https://github.com/openstack/openstack-
ansible
THE NTP SIMPLE EXAMPLE
­ name: Setup ntp client
  hosts: linuxVMs
  # target hosts
  remote_user: tester # connect as ‘tester’ account
  sudo: True  # and need sudo
  vars:
    ­ other_clocks: [ntp1aus2.hp.net, gpsclock0.sdd.hp.com, ntp1.ed
  roles:
    ­ {role: ntpclient, time_sources: “{{ other_clocks }}”, }
  tasks:
    ­ name: The os are we running on
      debug: msg=“this is a {{ansible_distribution}} {{ansible_dis
­­­­­­­­­­­­­­­­ the roles/ntplient sub directory content ­­­­­­
roles/ntpclient
├── defaults
│
└── main.yml ­> content is vars section on previous slide
├── handlers
│
└── main.yml ­> content is the handler section on previous slide
├── tasks
│
└── main.yml ­> content is the tasks section on previous slide
ANSIBLE - A LOT MORE TO DISCOVER
WE JUST SCRATCHED THE SURFACE
Ansible conditionals
Ansible loops
Ansible-Vault
Facts
Jinja2 filters
...
SIMPLE LIVE EXAMPLES
THANK YOU
Based on original presentation from :
Philippe Eveque <philippe.eveque@hp.com>
Adaptation to openstack by :
Jérome Justet <jerome.justet@hp.com>
René Ribaud <rene.ribaud@hp.com>

More Related Content

What's hot

Using Elyra for COVID-19 Analytics
Using Elyra for COVID-19 AnalyticsUsing Elyra for COVID-19 Analytics
Using Elyra for COVID-19 AnalyticsLuciano Resende
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3Qualcomm Developer Network
 
In-kernel Analytics and Tracing with eBPF for OpenStack Clouds
In-kernel Analytics and Tracing with eBPF for OpenStack CloudsIn-kernel Analytics and Tracing with eBPF for OpenStack Clouds
In-kernel Analytics and Tracing with eBPF for OpenStack CloudsPLUMgrid
 
Develop, Deploy, and Innovate with Intel® Cluster Ready
Develop, Deploy, and Innovate with Intel® Cluster ReadyDevelop, Deploy, and Innovate with Intel® Cluster Ready
Develop, Deploy, and Innovate with Intel® Cluster ReadyIntel IT Center
 
The Rise of the Monorepo at NVIDIA 
The Rise of the Monorepo at NVIDIA The Rise of the Monorepo at NVIDIA 
The Rise of the Monorepo at NVIDIA Perforce
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineLinaro
 
Infrastructure as Code for Network
Infrastructure as Code for NetworkInfrastructure as Code for Network
Infrastructure as Code for NetworkDamien Garros
 
SDVIs and In-Situ Visualization on TACC's Stampede
SDVIs and In-Situ Visualization on TACC's StampedeSDVIs and In-Situ Visualization on TACC's Stampede
SDVIs and In-Situ Visualization on TACC's StampedeIntel® Software
 
Docker at and with SignalFx
Docker at and with SignalFxDocker at and with SignalFx
Docker at and with SignalFxSignalFx
 
Best Practices and Performance Studies for High-Performance Computing Clusters
Best Practices and Performance Studies for High-Performance Computing ClustersBest Practices and Performance Studies for High-Performance Computing Clusters
Best Practices and Performance Studies for High-Performance Computing ClustersIntel® Software
 
OneAPI Series 2 Webinar - 9th, Dec-20
OneAPI Series 2 Webinar - 9th, Dec-20OneAPI Series 2 Webinar - 9th, Dec-20
OneAPI Series 2 Webinar - 9th, Dec-20Tyrone Systems
 
OneAPI dpc++ Virtual Workshop 9th Dec-20
OneAPI dpc++ Virtual Workshop 9th Dec-20OneAPI dpc++ Virtual Workshop 9th Dec-20
OneAPI dpc++ Virtual Workshop 9th Dec-20Tyrone Systems
 
GTC15-Manoj-Roge-OpenPOWER
GTC15-Manoj-Roge-OpenPOWERGTC15-Manoj-Roge-OpenPOWER
GTC15-Manoj-Roge-OpenPOWERAchronix
 
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...Edge AI and Vision Alliance
 
DockerCon SF 2015: Cultural Change using Docker
DockerCon SF 2015: Cultural Change using Docker DockerCon SF 2015: Cultural Change using Docker
DockerCon SF 2015: Cultural Change using Docker Docker, Inc.
 
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation EcosystemHow APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation EcosystemCisco DevNet
 
A Network Engineer's Approach to Automation
A Network Engineer's Approach to AutomationA Network Engineer's Approach to Automation
A Network Engineer's Approach to AutomationJeremy Schulman
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Qualcomm Developer Network
 

What's hot (20)

Using Elyra for COVID-19 Analytics
Using Elyra for COVID-19 AnalyticsUsing Elyra for COVID-19 Analytics
Using Elyra for COVID-19 Analytics
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
 
In-kernel Analytics and Tracing with eBPF for OpenStack Clouds
In-kernel Analytics and Tracing with eBPF for OpenStack CloudsIn-kernel Analytics and Tracing with eBPF for OpenStack Clouds
In-kernel Analytics and Tracing with eBPF for OpenStack Clouds
 
Develop, Deploy, and Innovate with Intel® Cluster Ready
Develop, Deploy, and Innovate with Intel® Cluster ReadyDevelop, Deploy, and Innovate with Intel® Cluster Ready
Develop, Deploy, and Innovate with Intel® Cluster Ready
 
The Rise of the Monorepo at NVIDIA 
The Rise of the Monorepo at NVIDIA The Rise of the Monorepo at NVIDIA 
The Rise of the Monorepo at NVIDIA 
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
 
Infrastructure as Code for Network
Infrastructure as Code for NetworkInfrastructure as Code for Network
Infrastructure as Code for Network
 
SDVIs and In-Situ Visualization on TACC's Stampede
SDVIs and In-Situ Visualization on TACC's StampedeSDVIs and In-Situ Visualization on TACC's Stampede
SDVIs and In-Situ Visualization on TACC's Stampede
 
Docker at and with SignalFx
Docker at and with SignalFxDocker at and with SignalFx
Docker at and with SignalFx
 
Best Practices and Performance Studies for High-Performance Computing Clusters
Best Practices and Performance Studies for High-Performance Computing ClustersBest Practices and Performance Studies for High-Performance Computing Clusters
Best Practices and Performance Studies for High-Performance Computing Clusters
 
OneAPI Series 2 Webinar - 9th, Dec-20
OneAPI Series 2 Webinar - 9th, Dec-20OneAPI Series 2 Webinar - 9th, Dec-20
OneAPI Series 2 Webinar - 9th, Dec-20
 
Automation Evolution with Junos
Automation Evolution with JunosAutomation Evolution with Junos
Automation Evolution with Junos
 
OneAPI dpc++ Virtual Workshop 9th Dec-20
OneAPI dpc++ Virtual Workshop 9th Dec-20OneAPI dpc++ Virtual Workshop 9th Dec-20
OneAPI dpc++ Virtual Workshop 9th Dec-20
 
GTC15-Manoj-Roge-OpenPOWER
GTC15-Manoj-Roge-OpenPOWERGTC15-Manoj-Roge-OpenPOWER
GTC15-Manoj-Roge-OpenPOWER
 
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
 
Intel python 2017
Intel python 2017Intel python 2017
Intel python 2017
 
DockerCon SF 2015: Cultural Change using Docker
DockerCon SF 2015: Cultural Change using Docker DockerCon SF 2015: Cultural Change using Docker
DockerCon SF 2015: Cultural Change using Docker
 
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation EcosystemHow APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
 
A Network Engineer's Approach to Automation
A Network Engineer's Approach to AutomationA Network Engineer's Approach to Automation
A Network Engineer's Approach to Automation
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
 

Viewers also liked

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'rmcleay
 
Extending Ansible - Ansible Benelux meetup - Amsterdam 11-02-2016
Extending Ansible - Ansible Benelux meetup - Amsterdam 11-02-2016Extending Ansible - Ansible Benelux meetup - Amsterdam 11-02-2016
Extending Ansible - Ansible Benelux meetup - Amsterdam 11-02-2016Pavel Chunyayev
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationKumar Y
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!Jeff Geerling
 
Ansible Overview - System Administration and Maintenance
Ansible Overview - System Administration and MaintenanceAnsible Overview - System Administration and Maintenance
Ansible Overview - System Administration and MaintenanceJishnu P
 
Icinga Camp Amsterdam - Icinga2 and Ansible
Icinga Camp Amsterdam - Icinga2 and AnsibleIcinga Camp Amsterdam - Icinga2 and Ansible
Icinga Camp Amsterdam - Icinga2 and AnsibleIcinga
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible referencelaonap166
 
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerTesting Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerDennis Rowe
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 
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 CoffeeSarah Z
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with AnsibleMartin Etmajer
 
Ansible handson ood2016
Ansible handson ood2016Ansible handson ood2016
Ansible handson ood2016Hideki Saito
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricksbcoca
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleRobert Reiz
 

Viewers also liked (19)

Testing Ansible
Testing AnsibleTesting Ansible
Testing 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'
 
Extending Ansible - Ansible Benelux meetup - Amsterdam 11-02-2016
Extending Ansible - Ansible Benelux meetup - Amsterdam 11-02-2016Extending Ansible - Ansible Benelux meetup - Amsterdam 11-02-2016
Extending Ansible - Ansible Benelux meetup - Amsterdam 11-02-2016
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!
 
Building a devops CMDB
Building a devops CMDBBuilding a devops CMDB
Building a devops CMDB
 
Ansible Overview - System Administration and Maintenance
Ansible Overview - System Administration and MaintenanceAnsible Overview - System Administration and Maintenance
Ansible Overview - System Administration and Maintenance
 
Icinga Camp Amsterdam - Icinga2 and Ansible
Icinga Camp Amsterdam - Icinga2 and AnsibleIcinga Camp Amsterdam - Icinga2 and Ansible
Icinga Camp Amsterdam - Icinga2 and Ansible
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible reference
 
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerTesting Ansible with Jenkins and Docker
Testing Ansible with Jenkins and Docker
 
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 + Hadoop
Ansible + HadoopAnsible + Hadoop
Ansible + Hadoop
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Ansible handson ood2016
Ansible handson ood2016Ansible handson ood2016
Ansible handson ood2016
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 

Similar to Ansible a tool for dev ops

Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
Basics of Ansible - Sahil Davawala
Basics of Ansible - Sahil DavawalaBasics of Ansible - Sahil Davawala
Basics of Ansible - Sahil DavawalaSahil Davawala
 
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
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modulesmohamedmoharam
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Keith Resar
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonMyNOG
 
Intro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupIntro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupRamesh Godishela
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Idan Tohami
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Idan Tohami
 
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
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them AllTim Fairweather
 

Similar to Ansible a tool for dev ops (20)

Ansible intro
Ansible introAnsible intro
Ansible intro
 
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_Basics_ppt.pdf
Ansible_Basics_ppt.pdfAnsible_Basics_ppt.pdf
Ansible_Basics_ppt.pdf
 
Basics of Ansible - Sahil Davawala
Basics of Ansible - Sahil DavawalaBasics of Ansible - Sahil Davawala
Basics of Ansible - Sahil Davawala
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Ansible
AnsibleAnsible
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...
 
Ansible101
Ansible101Ansible101
Ansible101
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
 
ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent Boon
 
Intro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupIntro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetup
 
iac.pptx
iac.pptxiac.pptx
iac.pptx
 
Ansible
AnsibleAnsible
Ansible
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
 
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
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 

Recently uploaded

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Ansible a tool for dev ops

  • 2. SESSION OBJECTIVES Objectives Present Ansible, a popular tool used in Dev/Ops context The needs to automate tasks across distributed systems Typical needs Ansible use cases for managing Openstack
  • 4. WHAT IS ANSIBLE Ansible is a free software platform for configuring and managing computers. The platform was created by Michael DeHaan, he is the Cobbler author as well.
  • 5. THE NEED FOR AUTOMATION
  • 6. TYPICAL NEEDS As a developer/tester: during dev and test phase. Safely Do repetitive configurations tasks on a set of VMs implementing a multi-tier cluster Provision ssh public keys of team members on N freshly deployed nodes during dev phase Automate a documented complex installation sequence – BTW why writing such a document ? etc As a Sysadmin/Sysops Automate remote scripting of many day to day tasks Check and maintain configuration on systems, can be coupled with a revision management tool As a Service Delivery team: efficiency Efficient deployment of complex solutions with easily injecting customers or deal specific configuration parameters Avoid restarting from start when you hit an error Do it faster and cheaper and at scale As <anyone> Be efficient in front of the explosion of the # of entities (servers, VMs, ...) to ‘manage’
  • 7. THE AVAILABLE TOOLS ANDKEY PROPERTIES The ‘old ways’ we all experimented: is gone Document the pre-requisites, document the sequence of actions. Keeping the doc up to date and tested is time consuming. Doc is subject to interpretation, ... Shell scripting Handling errors correctly is hard. Designing them to avoid restart from scratch is even harder The current way: Configuration management and automation frameworks. Puppet, Chef, Salt, All promote idempotency Ansible addresses most of the issues at low cost Easy to learn and debug Open source software (with commercial support available) Leaves no “fingerprints” or residue on target systems Predictable execution / Repeatable / Idempotent Mostly / Parallel operations Ansible
  • 8. ANSIBLE BASICS AND KEY CONCEPTS
  • 9. ANSIBLE ARCHITECTURE AND WORKING MODEL An ‘orchestration engine’ where Ansible SW is installed. No agent required. leverage ssh as default secure transport. Execute playbooks. Predictable – in order execution Designed to work in push mode to all target hosts in parallel. hosts can be many things: Any Linux/*Nix systems networking gears running sshd Windows hosts by leverging WinRM and PowerShell (hence no ssh in that case) And more...
  • 10. THE INVENTORY WHERE THE HOSTS ARE REGISTERED ABOUTINVENTORIES Static inventory: A file containing a set of hosts and groups of hosts. Can also contain some host specific settings. Common practice is to name groups per intended function. Dynamic inventory – hosts and groups from external source via inventory plugin. From a CMDB From a cloud provider (e.g: AWS EC2/Eucalyptus, Rackspace Cloud. OpenStack nova, gce, digital ocean ...) Useful when hosts names are hard to predict or when many hosts More than one inventory and mix of static and dynamic inventory sources is possible: One for development, one for staging, one for production One for public cloud one for private cloud EXAMPLE OF ASIMPLE STATIC INVENTORY – NO DBNEEDED # This is a comment          # localhost refers to the ansible control node localhost [webservers] www1.example.com www2.example.com www[10:50].example.com [dbservers]  db1.example.com       db[a:f].example.com 10.0.1.9 ansible_ssh_port=2222 ansible_ssh_user=admin [LinuxVMs] localhost db1.example.com www21.example.com
  • 11. ANSIBLE PLAYBOOKS - THE PLAYS ALISTOF PLAYS TO RUN ON TARGETHOSTS Playbooks are yaml text files containing a list of plays and run via the ansible-playbook cli Playbooks can be hierarchical and use structured directory and file layout. A play maps a set of hosts with “what to execute” on them Has a name: descriptive text Start with a section specifying the set of target hosts with the parameters to access them. May contain variables declaration sections Contains sections specifying “what to run” on them A play optionally ‘gather Facts’ and makes them available as variables. Facts are all the information Ansible discovers about a host. Each play is run in sequence and may specify the account (remote_user) to be used to connect to the remote hosts, if sudo is needed, etc PLAYBOOKEXTRACT– THE FIRSTSECTION OF APLAY ­ name: This is the PLAY1 title   hosts: webservers  # this can be host, groups or complex expr   gather_facts: True  # trigger facts discovery about targets   remote_user tester  # connect as 'tester' account   sudo: False         # whether to run as sudo or not   [...skipped part...] # what to run on the targets – skipped ­ name: This is the PLAY2 Title    hosts: dbservers:!db1.example.com # exclude a host   gather_facts: False   remote_user: admin  # connect as 'admin' account   sudo: True   [...skipped part...] # what to run on the targets – skipped
  • 12. ANSIBLE PLAYBOOKS – THE TASKS WHATTO RUN ON TARGETHOSTS The tasks section describes the list of actions you want to execute on the target hosts The tasks are run in order, one at a time, against all the target hosts in parallel, before moving to the next. A task: Has a name : descriptive text Executes a module with specific parameters. Reports status [ok, changed, failed, skipping] at runtime Handlers are tasks triggered at the end of the play if a change was made A is a small program, generally idempotent and that can be written in any language *. There are modules for many things, see the module index. You can write your own. Variables and templates leverage jinja2 templating engine module THE NTP SIMPLE EXAMPLE ­ name: Setup ntp client   hosts: linuxVMs:!localhost # target hosts   remote_user: tester # connect as ‘tester’ account    sudo: True # and need sudo capability   vars:     ­ time_sources: [ntp2.austin.hp.com, gpsclock0.sdd.hp.com, ntp1     ­ ntp_rpm: ntp   tasks:     ­ name: Install the required  time service package       yum: name={{ ntp_rpm }} state=installed     ­ name: Instantiate the ntp.conf from template file       template: src=ntp.conf.j2  dest=/etc/ntp.conf   notify:      ­ restart time server daemon     ­ name: The os are we running on       debug: msg=“this is a {{ ansible_distribution }} {{ ansible_   handlers:     ­ name: restart time server daemon       service: name=ntpd state=restarted enabled=yes
  • 13. ANSIBLE ROLES PARAMETERIZEDTASKS FORSHARINGANDREUSE Rapidly you will need to reuse some tasks, or abstract some consecutive tasks and give it a name. A role is materialized as a set of structured files and may have: A set of defaults (aka default values) A tasks list handlers Templates files files meta vars This works like an clever include directive Hint: browse the roles repository and use the ansible-galaxy cli to get them. Openstack playbooks : Ansible Galaxy https://github.com/openstack/openstack- ansible THE NTP SIMPLE EXAMPLE ­ name: Setup ntp client   hosts: linuxVMs   # target hosts   remote_user: tester # connect as ‘tester’ account   sudo: True  # and need sudo   vars:     ­ other_clocks: [ntp1aus2.hp.net, gpsclock0.sdd.hp.com, ntp1.ed   roles:     ­ {role: ntpclient, time_sources: “{{ other_clocks }}”, }   tasks:     ­ name: The os are we running on       debug: msg=“this is a {{ansible_distribution}} {{ansible_dis ­­­­­­­­­­­­­­­­ the roles/ntplient sub directory content ­­­­­­ roles/ntpclient ├── defaults │ └── main.yml ­> content is vars section on previous slide ├── handlers │ └── main.yml ­> content is the handler section on previous slide ├── tasks │ └── main.yml ­> content is the tasks section on previous slide
  • 14. ANSIBLE - A LOT MORE TO DISCOVER WE JUST SCRATCHED THE SURFACE Ansible conditionals Ansible loops Ansible-Vault Facts Jinja2 filters ...
  • 16. THANK YOU Based on original presentation from : Philippe Eveque <philippe.eveque@hp.com> Adaptation to openstack by : Jérome Justet <jerome.justet@hp.com> René Ribaud <rene.ribaud@hp.com>