SlideShare a Scribd company logo
Introduction to
Ansible
1
What is Ansible?
It's a simple automation language that can perfectly describe an
IT application infrastructure in Ansible Playbooks.
It's an automation engine that runs Ansible Playbooks.
Ansible is an automation platform:
● Playbooks make up the automation language
● The code base is the automation engine.
● Ansible Tower manages existing automation
Community
THE MOST POPULAR OPEN-SOURCE AUTOMATION COMMUNITY ON
GITHUB
● 33,500+ stars & 11,000+ forks on GitHub
● 3,300+ GitHub Contributors
● Over 3000 modules shipped with Ansible
● New contributors added every day
● 1,500+ users on IRC channel
● Top 10 open source projects in 2017
● World-wide meetups taking place every week
● Ansible Galaxy: over 18,000 subscribers
● 500,000+ downloads a month
● AnsibleFests in Austin, NYC, SF, London
http://ansible.com/community
Why Ansible? What Sets Ansible
Apart?
SIMPLE POWERFUL AGENTLESS
Human readable automation App deployment Agentless architecture
No special coding skills needed Configuration management Uses OpenSSH & WinRM
Tasks executed in order Workflow orchestration No agents to exploit or update
Usable by every team Network automation Get started immediately
Get productive quickly Orchestrate the app lifecycle More efficient & more
secure
WHAT CAN I DO USING ANSIBLE?
Orchestration
Automate the deployment and management of your entire IT footprint.
Do this...
Firewalls
Configuration
Management
Application
Deployment
Provisioning Continuous
Delivery
Security and
Compliance
On
these...
Load Balancers Applications Containers Clouds
Servers Infrastructure Storage And
more...
Network Devices
CLOUD VIRT & CONTAINER WINDOWS NETWORK DEVOPS MONITORING
ANSIBLE AUTOMATES TECHNOLOGIES YOU
USE
Time to automate is measured in minutes
Docker
VMwar
e RHV
OpenStack
OpenShift
+more
ACLs
Files
Package
s IIS
Regedits
Shares
Services
Configs
Users
Domains
+more
Arista
A10
Cumulus
Bigswitch
Cisco
Cumulus
Dell
F5
Juniper
Palo Alto
OpenSwitch
+more
Jira
GitHub
Vagrant
Jenkins
Bamboo
Atlassian
Subversion
Slack
Hipchat
+more
Dynatrace
Airbrake
BigPanda
Datadog
LogicMonitor
Nagios
New Relic
PagerDuty
Sensu
StackDriver
Zabbix
+more
STORAGE
NetApp
Red Hat
Storage
Infinidat
+more
AWS
Azure
Digital Ocean
Google
OpenStack
Rackspace
+more
OPERATING
SYSTEMS
RHEL and
Linux UNIX
Windows
+more
Installing Ansible
# you will need the extras repo configured on RHEL,
# along with the Ansible Engine repository on RHEL 7
$ sudo yum install ansible
# Ansible can be installed via “pip”, the Python
# package manager
$ sudo pip install ansible
# you will need the PPA repo configured on
# Debian or Ubuntu
$ sudo apt-get install ansible
ANSIBLE AUTOMATION ENGINE
CMDB
USERS
INVENTORY
HOSTS
NETWORK
DEVICES
PLUGINS
CLI
MODULES
ANSIBLE
PLAYBOOK
PUBLIC / PRIVATE
CLOUD
PUBLIC / PRIVATE
CLOUD
CMDB
USERS
INVENTORY
HOSTS
NETWORK
DEVICES
PLUGINS
CLI
MODULES
ANSIBLE
PLAYBOOK
PUBLIC / PRIVATE
CLOUD
PUBLIC / PRIVATE
CLOUD
ANSIBLE AUTOMATION ENGINE
PLAYBOOKS ARE WRITTEN IN YAML
Tasks are executed
sequentially
Invoke Ansible modules
CMDB
USERS
INVENTORY
HOSTS
NETWORK
DEVICES
PLUGINS
CLI
ANSIBLE
PLAYBOOK
PUBLIC / PRIVATE
CLOUD
PUBLIC / PRIVATE
CLOUD
If Ansible is an engine the modules are
the tools in the toolkit
ANSIBLE
Python, Powershell, or any language Extend
Ansible simplicity to the entire stack
MODULES
CORE NETWORK COMMUNITY
CMDB
USERS
INVENTORY
HOSTS
NETWORK
DEVICES
CLI
ANSIBLE
PLAYBOOK
PUBLIC / PRIVATE
CLOUD
PUBLIC / PRIVATE
CLOUD
PLUGINS ARE “GEARS IN THE ENGINE”
Code that plugs into the core engine
MODULES PLUGINS
CMDB
USERS
HOSTS
NETWORK
ANSIBLE
PLAYBOOK
PUBLIC / PRIVATE
CLOUD
PUBLIC / PRIVATE
CLOUD
MODULES PLUGINS
INVENTORY
INVENTORY
[web]
ANSIBLE AUTOMATION
EwNeGbIsNeErver1
.example.com
webserver2.example.com
[db]
dbserver1.example.com
CLI
[switches]
leaf01.internal.com
leaf02.internal.com
[firewalls]
checkpoint01.internDaEVlI.
CcESom
[lb]
f5-01.internal.com
ANSIBLE AUTOMATION ENGINE
USERS
NETWORK
DEVICES
PLAYBOOK
INVENTORY
PUBLIC / PRIVATE
CLOUD PUBLIC / PRIVATE
CLOUD
CLOUD
RH OpenStack, RH Satellite, VMWare
AAWS, Rackspace, Google Compute Engine, Azure
CMDB
ServiceNow, Cobbler, BMC,Custom cmdb
CMDB
ANSIBLE AUTOMATION ENGINE
USERS
CLI
PLAYBOOK
INVENTORY
PUBLIC / PRIVATE
CLOUD
PUBLIC / PRIVATE
CLOUD
CMDB
HOSTS
NETWORK
DEVICES
MODULES PLUGINS
AUTOMATE EVERYTHING
ARHEL, Ubuntu, Debian,
Cisco routers, Arista switches, Juniper routers,
Windows hosts, Checkpoint firewalls and more
Modules
Modules are bits of code transferred to the target system and executed to satisfy
the task declaration.
● apt/yum
● copy
● file
● get_url
● git
● ping
● debug
● service
● synchronize
● template
● uri
● user
● wait_for
● assert
1
6
docs.ansible.com
Modules: Run Commands
If Ansible doesn't have a module that suits your needs there are
the “run command” modules:
● command: Takes the command and executes it on the host. The
most secure and predictable.
● shell: Executes through a shell like /bin/sh so you can use pipes
etc. Be careful.
● script: Runs a local script on a remote node after transferring it.
● raw: Executes a command without going through the Ansible
module subsystem.
NOTE: Unlike standard modules, run commands have no concept of
desired state and should only be used as a last resort.
Inventory
Inventory is a collection of hosts (nodes) with associated
data and groupings that Ansible can connect and manage.
● Hosts (nodes)
● Groups
● Inventory-specific data (variables)
● Static or dynamic sources
Static Inventory Example
10.42.0.2
10.42.0.6
10.42.0.7
10.42.0.8
10.42.0.100
host.example.com
Static Inventory Example
[control]
tower ansible_host=10.42.0.2
[web]
node-[1:3] ansible_host=10.42.0.[6:8]
[haproxy]
haproxy ansible_host=10.42.0.100
[all:vars]
ansible_user=vagrant
ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
Use a single source of truth if you have it -- even if
you have multiple sources, Ansible can unify them.
● Stay in sync automatically
● Reduce human error
INVENTORY
2
1
PUBLIC /
PRIVATE
CLOUD
CMDB
Ad-Hoc Commands
An ad-hoc command is a single Ansible task to perform
quickly, but don’t want to save for later.
Ad-Hoc Commands
# check all my inventory hosts are ready to be
# managed by Ansible
$ ansible all -m ping
# collect and display the discovered facts
# for the localhost
$ ansible localhost -m setup
# run the uptime command on all hosts in the
# web group
$ ansible web -m command -a "uptime"
Sidebar: Discovered Facts
Facts are bits of information derived from examining a host systems
that are stored as variables for later use in a play.
$ ansible localhost -m setup
localhost | success >> {
"ansible_facts": {
"ansible_default_ipv4": {
"address": "192.168.1.37",
"alias": "wlan0",
"gateway": "192.168.1.1",
"interface": "wlan0",
"macaddress": "c4:85:08:3b:a9:16",
"mtu": 1500,
"netmask": "255.255.255.0",
"network": "192.168.1.0",
"type": "ether"
},
Variables
Ansible can work with metadata from various sources and
manage their context in the form of variables.
● Command line parameters
● Plays and tasks
● Files
● Inventory
● Discovered facts
● Roles
Variable Precedence
The order in which the same variable from different sources will
override each other.
● extra vars
● task vars (only for the task)
● block vars (only for tasks in
block)
● role and include vars
● play vars_files
● play vars_prompt
● play vars
● set_facts
● registered vars
● host facts
● playbook host_vars
● playbook group_vars
● Inventory host_vars
● inventory group_vars
● inventory vars
● role defaults
Tasks
Tasks are the application of a module to perform a specific unit of
work.
● file: A directory should exist
● yum: A package should be installed
● service: A service should be running
● template: Render a configuration file from a template
● get_url: Fetch an archive file from a URL
● git: Clone a source code repository
Example Tasks in a Play
tasks:
- name: httpd package is present
yum:
name: httpd
state: latest
- name: latest index.html file is present
copy:
src: files/index.html
dest: /var/www/html/
- name: restart httpd
service:
name: httpd
state: restarted
Handler Tasks
Handlers are special tasks that run at the end of a play if
notified by another task when a change occurs.
If a package gets installed or updated, notify a service restart task
that it needs to run.
Example Handler Task in a Play
tasks:
- name: httpd package is present
yum:
name: httpd
state: latest
notify: restart httpd
- name: latest index.html file is present
copy:
src: files/index.html
dest: /var/www/html/
handlers:
- name: restart httpd
service:
name: httpd
state: restarted
Plays & Playbooks
Plays are ordered sets of tasks to execute against host
selections from your inventory. A playbook is a file containing
one or more plays.
Playbook Example
---
- name: install and start apache
hosts: web
become: yes
vars:
http_port: 80
tasks:
- name: httpd package is present
yum:
name: httpd
state: latest
- name: latest index.html file is present
copy:
src: files/index.html
dest:/var/www/html/
- name: start httpd
service:
name: httpd
state: started
Human-Meaningful Naming
---
- name: install and start apache
hosts: web
become: yes
vars:
http_port: 80
tasks:
- name: httpd package is present
yum:
name: httpd
state: latest
- name: latest index.html file is present
copy:
src: files/index.html
dest: /var/www/html/
- name: httpd is started
service:
name: httpd
state: started
Host Selector
---
- name: install and start apache
hosts: web
become: yes
vars:
http_port: 80
tasks:
- name: httpd package is present
yum:
name: httpd
state: latest
- name: latest index.html file is present
copy:
src: files/index.html
dest: /var/www/html/
- name: httpd is started
service:
name: httpd
state: started
Privilege Escalation
---
- name: install and start apache
hosts: web
become: yes
vars:
http_port: 80
tasks:
- name: httpd package is present
yum:
name: httpd
state: latest
- name: latest index.html file is present
copy:
src: files/index.html
dest: /var/www/html/
- name: httpd is started
service:
name: httpd
state: started
Play Variables
---
- name: install and start apache
hosts: web
become: yes
vars:
http_port: 80
tasks:
- name: httpd package is present
yum:
name: httpd
state: latest
- name: latest index.html file is present
copy:
src: files/index.html
dest: /var/www/html/
- name: httpd is started
service:
name: httpd
state: started
Tasks
---
- name: install and start apache
hosts: web
become: yes
vars:
http_port: 80
tasks:
- name: httpd package is present
yum:
name: httpd
state: latest
- name: latest index.html file is present
copy:
src: files/index.html
dest: /var/www/html/
- name: httpd is started
service:
name: httpd
state: started
Role
s
Roles are a packages of closely related Ansible content that
can be shared more easily than plays alone.
● Improves readability and maintainability of complex plays
● Eases sharing, reuse and standardization of automation
processes
● Enables Ansible content to exist independently of
playbooks, projects -- even organizations
● Provides functional conveniences such as file path
resolution and default values
Project with Embedded Roles Example
site.yml
roles/
common/
files/
templates/
tasks/
handlers/
vars/
defaults/
meta/
apache/
files/
templates/
tasks/
handlers/
vars/
defaults/
meta/
Project with Embedded Roles Example
# site.yml
---
- hosts: web
roles:
- common
- apache
Q&A
Thank
You!

More Related Content

What's hot

Investigation of testing with ansible
Investigation of testing with ansibleInvestigation of testing with ansible
Investigation of testing with ansible
Dennis Rowe
 
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
Simplilearn
 
Docker ansible-make-chef-puppet-unnecessary-minnihan
Docker ansible-make-chef-puppet-unnecessary-minnihanDocker ansible-make-chef-puppet-unnecessary-minnihan
Docker ansible-make-chef-puppet-unnecessary-minnihan
jbminn
 

What's hot (20)

Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Ansible module development 101
Ansible module development 101Ansible module development 101
Ansible module development 101
 
Investigation of testing with ansible
Investigation of testing with ansibleInvestigation of testing with ansible
Investigation of testing with ansible
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Continuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudContinuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in Cloud
 
Ansible Crash Course
Ansible Crash CourseAnsible Crash Course
Ansible Crash Course
 
Ansible - A 'crowd' introduction
Ansible - A 'crowd' introductionAnsible - A 'crowd' introduction
Ansible - A 'crowd' introduction
 
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 - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
 
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerTesting Ansible with Jenkins and Docker
Testing Ansible with Jenkins and Docker
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
Docker ansible-make-chef-puppet-unnecessary-minnihan
Docker ansible-make-chef-puppet-unnecessary-minnihanDocker ansible-make-chef-puppet-unnecessary-minnihan
Docker ansible-make-chef-puppet-unnecessary-minnihan
 
Introduction to ansible galaxy
Introduction to ansible galaxyIntroduction to ansible galaxy
Introduction to ansible galaxy
 
Fluentd Meetup 2016 - ServerEngine Integration & Windows support
Fluentd Meetup 2016 - ServerEngine Integration & Windows supportFluentd Meetup 2016 - ServerEngine Integration & Windows support
Fluentd Meetup 2016 - ServerEngine Integration & Windows support
 
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!
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
 
Continuous infrastructure testing
Continuous infrastructure testingContinuous infrastructure testing
Continuous infrastructure testing
 
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
 

Similar to Intro to-ansible-sep7-meetup

Ansible automation sa technical deck q2 fy19
Ansible automation sa technical deck q2 fy19Ansible automation sa technical deck q2 fy19
Ansible automation sa technical deck q2 fy19
dvillaco
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
mohamedmoharam
 

Similar to Intro to-ansible-sep7-meetup (20)

ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Ansible automation sa technical deck q2 fy19
Ansible automation sa technical deck q2 fy19Ansible automation sa technical deck q2 fy19
Ansible automation sa technical deck q2 fy19
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Basics of Ansible - Sahil Davawala
Basics of Ansible - Sahil DavawalaBasics of Ansible - Sahil Davawala
Basics of Ansible - Sahil Davawala
 
Introducing Ansible
Introducing AnsibleIntroducing Ansible
Introducing Ansible
 
Getting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdfGetting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdf
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides
 
Ansible a tool for dev ops
Ansible a tool for dev opsAnsible a tool for dev ops
Ansible a tool for dev ops
 
UNIT-I Introduction to Ansible.pptx
UNIT-I Introduction to Ansible.pptxUNIT-I Introduction to Ansible.pptx
UNIT-I Introduction to Ansible.pptx
 
CloudOpen 2014 - Extending Cloud Automation, When OpenStack Meets Ansible
CloudOpen 2014 - Extending Cloud Automation, When OpenStack Meets AnsibleCloudOpen 2014 - Extending Cloud Automation, When OpenStack Meets Ansible
CloudOpen 2014 - Extending Cloud Automation, When OpenStack Meets Ansible
 
Ansible_Basics_ppt.pdf
Ansible_Basics_ppt.pdfAnsible_Basics_ppt.pdf
Ansible_Basics_ppt.pdf
 
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 automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent Boon
 
Ansible Hands On
Ansible Hands OnAnsible Hands On
Ansible Hands On
 
MongoDB Management & Ansible
MongoDB Management & AnsibleMongoDB Management & Ansible
MongoDB Management & Ansible
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
 

Recently uploaded

Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
AbrahamGadissa
 

Recently uploaded (20)

HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWINGBRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Toll tax management system project report..pdf
Toll tax management system project report..pdfToll tax management system project report..pdf
Toll tax management system project report..pdf
 
Explosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdfExplosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdf
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfA CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
 
Peek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdfPeek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answer
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Pharmacy management system project report..pdf
Pharmacy management system project report..pdfPharmacy management system project report..pdf
Pharmacy management system project report..pdf
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 

Intro to-ansible-sep7-meetup

  • 2. What is Ansible? It's a simple automation language that can perfectly describe an IT application infrastructure in Ansible Playbooks. It's an automation engine that runs Ansible Playbooks. Ansible is an automation platform: ● Playbooks make up the automation language ● The code base is the automation engine. ● Ansible Tower manages existing automation
  • 3. Community THE MOST POPULAR OPEN-SOURCE AUTOMATION COMMUNITY ON GITHUB ● 33,500+ stars & 11,000+ forks on GitHub ● 3,300+ GitHub Contributors ● Over 3000 modules shipped with Ansible ● New contributors added every day ● 1,500+ users on IRC channel ● Top 10 open source projects in 2017 ● World-wide meetups taking place every week ● Ansible Galaxy: over 18,000 subscribers ● 500,000+ downloads a month ● AnsibleFests in Austin, NYC, SF, London http://ansible.com/community
  • 4. Why Ansible? What Sets Ansible Apart? SIMPLE POWERFUL AGENTLESS Human readable automation App deployment Agentless architecture No special coding skills needed Configuration management Uses OpenSSH & WinRM Tasks executed in order Workflow orchestration No agents to exploit or update Usable by every team Network automation Get started immediately Get productive quickly Orchestrate the app lifecycle More efficient & more secure
  • 5. WHAT CAN I DO USING ANSIBLE? Orchestration Automate the deployment and management of your entire IT footprint. Do this... Firewalls Configuration Management Application Deployment Provisioning Continuous Delivery Security and Compliance On these... Load Balancers Applications Containers Clouds Servers Infrastructure Storage And more... Network Devices
  • 6. CLOUD VIRT & CONTAINER WINDOWS NETWORK DEVOPS MONITORING ANSIBLE AUTOMATES TECHNOLOGIES YOU USE Time to automate is measured in minutes Docker VMwar e RHV OpenStack OpenShift +more ACLs Files Package s IIS Regedits Shares Services Configs Users Domains +more Arista A10 Cumulus Bigswitch Cisco Cumulus Dell F5 Juniper Palo Alto OpenSwitch +more Jira GitHub Vagrant Jenkins Bamboo Atlassian Subversion Slack Hipchat +more Dynatrace Airbrake BigPanda Datadog LogicMonitor Nagios New Relic PagerDuty Sensu StackDriver Zabbix +more STORAGE NetApp Red Hat Storage Infinidat +more AWS Azure Digital Ocean Google OpenStack Rackspace +more OPERATING SYSTEMS RHEL and Linux UNIX Windows +more
  • 7. Installing Ansible # you will need the extras repo configured on RHEL, # along with the Ansible Engine repository on RHEL 7 $ sudo yum install ansible # Ansible can be installed via “pip”, the Python # package manager $ sudo pip install ansible # you will need the PPA repo configured on # Debian or Ubuntu $ sudo apt-get install ansible
  • 9. CMDB USERS INVENTORY HOSTS NETWORK DEVICES PLUGINS CLI MODULES ANSIBLE PLAYBOOK PUBLIC / PRIVATE CLOUD PUBLIC / PRIVATE CLOUD ANSIBLE AUTOMATION ENGINE PLAYBOOKS ARE WRITTEN IN YAML Tasks are executed sequentially Invoke Ansible modules
  • 10. CMDB USERS INVENTORY HOSTS NETWORK DEVICES PLUGINS CLI ANSIBLE PLAYBOOK PUBLIC / PRIVATE CLOUD PUBLIC / PRIVATE CLOUD If Ansible is an engine the modules are the tools in the toolkit ANSIBLE Python, Powershell, or any language Extend Ansible simplicity to the entire stack MODULES CORE NETWORK COMMUNITY
  • 11. CMDB USERS INVENTORY HOSTS NETWORK DEVICES CLI ANSIBLE PLAYBOOK PUBLIC / PRIVATE CLOUD PUBLIC / PRIVATE CLOUD PLUGINS ARE “GEARS IN THE ENGINE” Code that plugs into the core engine MODULES PLUGINS
  • 12. CMDB USERS HOSTS NETWORK ANSIBLE PLAYBOOK PUBLIC / PRIVATE CLOUD PUBLIC / PRIVATE CLOUD MODULES PLUGINS INVENTORY INVENTORY [web] ANSIBLE AUTOMATION EwNeGbIsNeErver1 .example.com webserver2.example.com [db] dbserver1.example.com CLI [switches] leaf01.internal.com leaf02.internal.com [firewalls] checkpoint01.internDaEVlI. CcESom [lb] f5-01.internal.com
  • 13. ANSIBLE AUTOMATION ENGINE USERS NETWORK DEVICES PLAYBOOK INVENTORY PUBLIC / PRIVATE CLOUD PUBLIC / PRIVATE CLOUD CLOUD RH OpenStack, RH Satellite, VMWare AAWS, Rackspace, Google Compute Engine, Azure CMDB ServiceNow, Cobbler, BMC,Custom cmdb CMDB
  • 14. ANSIBLE AUTOMATION ENGINE USERS CLI PLAYBOOK INVENTORY PUBLIC / PRIVATE CLOUD PUBLIC / PRIVATE CLOUD CMDB HOSTS NETWORK DEVICES MODULES PLUGINS AUTOMATE EVERYTHING ARHEL, Ubuntu, Debian, Cisco routers, Arista switches, Juniper routers, Windows hosts, Checkpoint firewalls and more
  • 15. Modules Modules are bits of code transferred to the target system and executed to satisfy the task declaration. ● apt/yum ● copy ● file ● get_url ● git ● ping ● debug ● service ● synchronize ● template ● uri ● user ● wait_for ● assert
  • 17. Modules: Run Commands If Ansible doesn't have a module that suits your needs there are the “run command” modules: ● command: Takes the command and executes it on the host. The most secure and predictable. ● shell: Executes through a shell like /bin/sh so you can use pipes etc. Be careful. ● script: Runs a local script on a remote node after transferring it. ● raw: Executes a command without going through the Ansible module subsystem. NOTE: Unlike standard modules, run commands have no concept of desired state and should only be used as a last resort.
  • 18. Inventory Inventory is a collection of hosts (nodes) with associated data and groupings that Ansible can connect and manage. ● Hosts (nodes) ● Groups ● Inventory-specific data (variables) ● Static or dynamic sources
  • 20. Static Inventory Example [control] tower ansible_host=10.42.0.2 [web] node-[1:3] ansible_host=10.42.0.[6:8] [haproxy] haproxy ansible_host=10.42.0.100 [all:vars] ansible_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
  • 21. Use a single source of truth if you have it -- even if you have multiple sources, Ansible can unify them. ● Stay in sync automatically ● Reduce human error INVENTORY 2 1 PUBLIC / PRIVATE CLOUD CMDB
  • 22. Ad-Hoc Commands An ad-hoc command is a single Ansible task to perform quickly, but don’t want to save for later.
  • 23. Ad-Hoc Commands # check all my inventory hosts are ready to be # managed by Ansible $ ansible all -m ping # collect and display the discovered facts # for the localhost $ ansible localhost -m setup # run the uptime command on all hosts in the # web group $ ansible web -m command -a "uptime"
  • 24. Sidebar: Discovered Facts Facts are bits of information derived from examining a host systems that are stored as variables for later use in a play. $ ansible localhost -m setup localhost | success >> { "ansible_facts": { "ansible_default_ipv4": { "address": "192.168.1.37", "alias": "wlan0", "gateway": "192.168.1.1", "interface": "wlan0", "macaddress": "c4:85:08:3b:a9:16", "mtu": 1500, "netmask": "255.255.255.0", "network": "192.168.1.0", "type": "ether" },
  • 25. Variables Ansible can work with metadata from various sources and manage their context in the form of variables. ● Command line parameters ● Plays and tasks ● Files ● Inventory ● Discovered facts ● Roles
  • 26. Variable Precedence The order in which the same variable from different sources will override each other. ● extra vars ● task vars (only for the task) ● block vars (only for tasks in block) ● role and include vars ● play vars_files ● play vars_prompt ● play vars ● set_facts ● registered vars ● host facts ● playbook host_vars ● playbook group_vars ● Inventory host_vars ● inventory group_vars ● inventory vars ● role defaults
  • 27. Tasks Tasks are the application of a module to perform a specific unit of work. ● file: A directory should exist ● yum: A package should be installed ● service: A service should be running ● template: Render a configuration file from a template ● get_url: Fetch an archive file from a URL ● git: Clone a source code repository
  • 28. Example Tasks in a Play tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: restart httpd service: name: httpd state: restarted
  • 29. Handler Tasks Handlers are special tasks that run at the end of a play if notified by another task when a change occurs. If a package gets installed or updated, notify a service restart task that it needs to run.
  • 30. Example Handler Task in a Play tasks: - name: httpd package is present yum: name: httpd state: latest notify: restart httpd - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ handlers: - name: restart httpd service: name: httpd state: restarted
  • 31. Plays & Playbooks Plays are ordered sets of tasks to execute against host selections from your inventory. A playbook is a file containing one or more plays.
  • 32. Playbook Example --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest:/var/www/html/ - name: start httpd service: name: httpd state: started
  • 33. Human-Meaningful Naming --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: name: httpd state: started
  • 34. Host Selector --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: name: httpd state: started
  • 35. Privilege Escalation --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: name: httpd state: started
  • 36. Play Variables --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: name: httpd state: started
  • 37. Tasks --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: name: httpd state: started
  • 38. Role s Roles are a packages of closely related Ansible content that can be shared more easily than plays alone. ● Improves readability and maintainability of complex plays ● Eases sharing, reuse and standardization of automation processes ● Enables Ansible content to exist independently of playbooks, projects -- even organizations ● Provides functional conveniences such as file path resolution and default values
  • 39. Project with Embedded Roles Example site.yml roles/ common/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/ apache/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/
  • 40. Project with Embedded Roles Example # site.yml --- - hosts: web roles: - common - apache
  • 41. Q&A