SlideShare a Scribd company logo
Ansible
DevOps for people who hate DevOps
John Lynch
CTO Kaleo Software
@johnrlynch
www.rigelgroupllc.com
In the beginning...
Developers wrote code
Systems Administrators deployed code
...until one day...
I know, I’ll write code to tell
the computer how to set up
itself!
Shell Scripts
•
#!/bin/sh
•
echo "fs.file-max=20000" | sudo tee -a /etc/sysctl.conf
•
sudo apt-get -y install build-essential postgresql-9.2
•
sudo apt-get -y install apache2
•
sudo a2enmod rewrite
•
sudo tee /etc/apache2/sites-available/mysite <<ENDOFFILE
•
<VirtualHost *:80>
•
Include /etc/apache2/sites-available/mysite-common
•
</VirtualHost>
•
ENDOFFILE
Shell Scripts :(
Not idempotent
Not “robust”
Everyone’s rolling their own
Shell Scripts
+
=
“Model-driven frameworks orchestration
complex infrastructure API organic solution
automation databag”
I need servers to
manage and deploy my
servers.
WAT?
Stop the madness!
Ansible
Simple to start
Scales “up” when you need it to
Ansible
The “Ansible”
Dependencies
Python
Jinja2
PyYAML
Paramiko
Servers
SSH
Python
Ansible
$ brew install python
$ pip install jinja2
$ pip install PyYAML
$ pip install paramiko
$ pip install ansible
The Basics
SSH Configuration
$ cat ~/.ssh/config
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/github_rsa
IdentityFile ~/.ssh/ec2_east
~/ansible_hosts
[local]
127.0.0.1
[web-group]
www.bsg.mil
www2.bsg.mil
[db-group]
10.0.1.123
Group Name
~/ansible_hosts
[local]
127.0.0.1
ansible_python_interpreter=/usr/local/Cell
ar/python/2.7.3/Frameworks/Python.framewor
k/Versions/2.7/Resources/Python.app/Conten
ts/MacOS/Python
Path to python
$ ansible all -m ping
$ ansible web-group -m ping
$ ansible all -a "/bin/echo hi"
$ ansible all -a "/sbin/reboot" -f 10
$ ansible all -m yum -a "name=nginx state=installed"
Ad-Hoc Commands
$ ansible all -m user -a "name=joe password=wat"
$ ansible all -m service -a "name=nginx state=started"
127.0.0.1 | success >> {
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"192.168.2.112"
],
"ansible_architecture": "x86_64",
"ansible_distribution": "MacOSX",
"ansible_distribution_version": "10.8.4",
"ansible_domain": "local",
"ansible_fqdn": "Johns-MacBook-Pro.local",
"ansible_hostname": "Johns-MacBook-Pro",
"ansible_kernel": "12.4.0",
"ansible_machine": "x86_64",
"ansible_memfree_mb": 4035,
"ansible_memtotal_mb": 16384,
"ansible_model": "MacBookPro10,1",
"ansible_os_family": "Darwin",
"ansible_osrevision": "199506",
"ansible_osversion": "12E55",
"ansible_pkg_mgr": "unknown",
"ansible_processor": "Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz",
"ansible_processor_cores": "4",
"ansible_python_version": "2.7.3",
"ansible_system": "Darwin",
"ansible_user_id": "john"
},
"changed": false
}
Ad-Hoc Commands
$ ansible local -m setup
Playbooks
YAML Files
Declaratively define your configuration
Can contain many “Plays” targeting different
Groups
my-playbook.yml
---
- hosts: webservers
user: root
vars:
http_port: 80
max_clients: 200
tasks:
- name: ensure apache is at the latest version
action: yum pkg=httpd state=latest
- name: write the apache config file
action: template src=httpd.j2 dest=/etc/httpd.conf
notify:
- restart apache
- name: ensure apache is running
action: service name=httpd state=started
handlers:
- name: restart apache
action: service name=httpd state=restarted
---
- hosts: webservers
user: root
vars_files:
- settings.yml
tasks:
- name: ensure apache is at the latest version
action: yum pkg=httpd state=latest
- name: write the apache config file
action: template src=/srv/httpd.j2 dest=/etc/httpd.conf
notify:
- restart apache
- name: ensure apache is running
action: service name=httpd state=started
handlers:
- name: restart apache
action: service name=httpd state=restarted
my-playbook.yml
my-playbook.yml
---
- hosts: webservers
user: root
vars_files:
- settings.yml
tasks:
- name: ensure apache is at the latest version
action: yum pkg=httpd state=latest
- name: recursively copy files from local to target
local_action: command rsync -a /path/to/files
{{ inventory_hostname }}:/path/to/target/
- name: ensure apache is running
action: service name=httpd state=started
handlers:
- name: restart apache
action: service name=httpd state=restarted
$ ansible-playbook mysite.yml -f 10
Running Playbooks
$ ansible-playbook mysite.yml --list-hosts
$ ec2-run-instances ami-bfd3a3d6 
-g Web 
-k ansible-ec2-us-east 
--instance-type m1.small
$ tee ~/.ssh/config <<ENDOFFILE
Host ec2-204-236-240-204.compute-1.amazonaws.com
IdentityFile ~/.ssh/ansible-ec2-us-east.pem
ENDOFFILE
$ tee ~/ansible_hosts <<ENDOFFILE
[ec2]
ec2-204-236-240-204.compute-1.amazonaws.com
ENDOFFILE
$ ansible ec2 -u ubuntu -m ping
Launch Instance
Demo
Ansible 201
Conditional Task Execution
Lookup vars in external files
Fireball Mode
Ansible 201
Ansible Modules for:
EC2, Rackspace, Linode, OpenStack, Digital Ocean
Route53, S3, RDS
MySQL, Postgres, Riak, Mongo
Airbrake, Monit, Nagios, NewRelic, Pingdom
Netscaler, BigIP, Arista
FlowDock, HipChat, IRC, Jaber, Email
Thank You!

More Related Content

What's hot

Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Simplilearn
 

What's hot (20)

IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
 
ansible why ?
ansible why ?ansible why ?
ansible why ?
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
DevOps with Ansible
DevOps with AnsibleDevOps with Ansible
DevOps with Ansible
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Ansible
AnsibleAnsible
Ansible
 
[오픈소스컨설팅] Ansible을 활용한 운영 자동화 교육
[오픈소스컨설팅] Ansible을 활용한 운영 자동화 교육[오픈소스컨설팅] Ansible을 활용한 운영 자동화 교육
[오픈소스컨설팅] Ansible을 활용한 운영 자동화 교육
 
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
 
Ansible
AnsibleAnsible
Ansible
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible
AnsibleAnsible
Ansible
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with Ansible
 

Viewers also liked

Viewers also liked (20)

Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
 
Introduzione DevOps con Ansible
Introduzione DevOps con AnsibleIntroduzione DevOps con Ansible
Introduzione DevOps con Ansible
 
Cyansible
CyansibleCyansible
Cyansible
 
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with Ansible
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
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
 
STIG Compliance and Remediation with Ansible
STIG Compliance and Remediation with AnsibleSTIG Compliance and Remediation with Ansible
STIG Compliance and Remediation with Ansible
 
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
 
Survey: Frozen Yogurt Market in India (2013)
Survey: Frozen Yogurt Market in India (2013)Survey: Frozen Yogurt Market in India (2013)
Survey: Frozen Yogurt Market in India (2013)
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation Workshop
 
Introduction to chef
Introduction to chefIntroduction to chef
Introduction to chef
 
Puppets
PuppetsPuppets
Puppets
 
Chef Delivery
Chef DeliveryChef Delivery
Chef Delivery
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
 
Infrastructure Automation with Chef
Infrastructure Automation with Chef Infrastructure Automation with Chef
Infrastructure Automation with Chef
 

Similar to Ansible presentation

Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
Yiwei Ma
 

Similar to Ansible presentation (20)

A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Hadoop on osx
Hadoop on osxHadoop on osx
Hadoop on osx
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Automation day red hat ansible
   Automation day red hat ansible    Automation day red hat ansible
Automation day red hat ansible
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
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
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOps
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopBuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec Workshop
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
 
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
 
Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)
 
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platformDrupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
 
InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018
 
Linux for programmers
Linux for programmersLinux for programmers
Linux for programmers
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 

Recently uploaded

Recently uploaded (20)

IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 

Ansible presentation