SlideShare a Scribd company logo
1 of 41
Download to read offline
Ansible
for
Beginners

…?

#pyfes 2013.11 in Tokyo
by @r_rudi(しろう)
Ansible
Chef
Puppet
Salt
cfengine
juju
…..
Provisioning
Tool
by Lee Thompson at Velocity 2010
s
n
A

le
ib
by Lee Thompson at Velocity 2010
Today’s
Assumptions
Task
- name: install python
homeblew: name=python
installs_options={{ option }}
state=present
Task
task name (optional)

- name: install python
arguments
homeblew: name=python
module name
installs_options={{ option }}
variables
state=present
status: uninstall if “absent”
(depends on the module)
Playbook == A set of Tasks
- hostname:
name=AnsibleDemo
- apt_repository:
repo=’deb http://….’
- apt_key:
url=http://…..

Order
How to run
% ansible-playbook hoge.yml
-i inventory file (connection host list)
-u username
-k ssh pass
-C check mode
-D diff
OK
Let' Go !
unarchive module
- unarchive: src=blah.tar.gz dest=/tmp/
copy

Remote

unzip
untar

Local

Remote
shell module
- shell: foo.sh
copy

Remote

Run

Local

Remote

Run
ec2
- local_action: ec2
args:
instance_type: c1.medium
image: emi-329394
count: 3
Launch Instances module
- Google Compute Engine
- Digital Ocean
- Linode
- Rackspace
- Docker
:
Q: How many instances?
- local_action: ec2
args:
count: 3
- local_action: ec2
args:
count: 3
- local_action: ec2
args:
count: 3
Q: How many instances?
- local_action: ec2
args:
count: 3
- local_action: ec2
args:
count: 3
- local_action: ec2
args:
count: 3

9
Q: How many instances?
- local_action: ec2
args:
count: 3
- local_action: ec2
args:
count: 3
- local_action: ec2
args:
count: 3

9
idempotence ...?
ec2 elb
- local_action: ec2_elb
args:
instance_id: “{{ ansible_ec2_instance_id
}}”
state: present
deploy !!
- local_action: ec2_elb
args: state=absent
- nagios: action=disable_alert
- git: repo=.... dest=/www version=release-11
- service: name=foo state=restarted
- wait_for: port=8080 state=started
:
rolling update
- serial: 1
Remote

- run only a server
at a single time

Remote

Remote
Python API
cause this is #pyfes
ansible + flask
from ansible.inventory import Inventory
from ansible.playbook import PlayBook
from ansible import callbacks
from flask import Flask, render_template
import json
app = Flask(__name__)
@app.route("/play")
def play():
inventory = Inventory('localhost.conf')
stats = callbacks.AggregateStats()
playbook_cb = callbacks.PlaybookCallbacks()

runner_cb = callbacks.
PlaybookRunnerCallbacks(stats)
results = PlayBook(playbook='pyfes-demo.
yml',
forks=1,
remote_user='shirou',
sudo=False,
module_path='module',
callbacks=playbook_cb,
runner_callbacks=runner_cb,
stats=stats,
inventory=inventory).run()
return json.dumps(results)
AnsibleWorks AWX
Demo
or Die
Web UI demo
True Demo: twilio module
- shell script using Twilio API
#!/usr/bin/env sh
AccountSid=AAAAAAAAA
AuthToken=07999999999999
curl -X POST 'https://api.twilio.com/2010-0401/Accounts/ACe0361e5b6236a8948191d08635bcd449/Calls.json' 
-d 'From=%2B822222222222' -d 'To=%2B81999999993' 
-d 'Url=http%3A%2F%2Fexample.com%2Fansible.html' -u
${AccountSid}:${AuthToken}
echo "changed=True"
exit 0
module creation
- super easy
- Write any script languages
- unfortunately, golang is impossible
- If you think it’s hard to write YAML, create
module
- auto execute if on the ./library
handler
tasks:
- template: src=/srv/hoge.j2 dest=/etc/hoge
notify:
- restart apache
handlers:
- name: restart apache
service: name=httpd state=restarted
How many servers
Ansible can manage?
We have users using Ansible in push mode
against 5000 machines at a time
Accelarated mode
- Launch daemon on server via SSH
- Then, direct connection
- terminate after playbook ends
- 2-8x faster than SSH

- hosts: all
accelerate: true
tasks: ...
Module introduction
Arista networks
- 10G/40G/100G switch

- login via ssh
- python included
Arista modules
- name: enable interface Ethernet 1
arista_interface:
interface_id=Ethernet1 admin=up
speed=10g duplex=full logging=true
DB
- mongodb_user
- mysql_db
- mysql_replication
- postgres_user
- postgres_db
- riak
- redis
notification
- irc
- hipchat
- jabber
- mail
- osx_say
Conclusion
- Can use Ansible as Remote Execution Tool
- So many modules
- Easy to create module if ansible does’nt have
- You don’t need Python
- Fast enough to manage over 1k servers
Ansible Book
- Release Nov. 2013
- cover wide area
- especially, not
included part this slide

More Related Content

What's hot

What's hot (20)

Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
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
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansible
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / Quickstart
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102
 
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.
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
 
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
 
Configuration Management in Ansible
Configuration Management in Ansible Configuration Management in Ansible
Configuration Management in Ansible
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
 

Viewers also liked

госы все
госы всегосы все
госы все
belfegor21
 
тестове завдання
тестове завданнятестове завдання
тестове завдання
Olga19744
 
Bai 1. th la nganh kh tiet 1
Bai 1. th la nganh kh tiet 1Bai 1. th la nganh kh tiet 1
Bai 1. th la nganh kh tiet 1
Ân Nguyễn
 
Nota 1 bahagian luar ikan hiasan
Nota 1 bahagian luar ikan hiasanNota 1 bahagian luar ikan hiasan
Nota 1 bahagian luar ikan hiasan
ctrosnahsue
 

Viewers also liked (20)

Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Introduction to Ansible (Pycon7 2016)
Introduction to Ansible (Pycon7 2016)Introduction to Ansible (Pycon7 2016)
Introduction to Ansible (Pycon7 2016)
 
Debugging ansible modules
Debugging ansible modulesDebugging ansible modules
Debugging ansible modules
 
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
 
госы все
госы всегосы все
госы все
 
тестове завдання
тестове завданнятестове завдання
тестове завдання
 
Bai 1. th la nganh kh tiet 1
Bai 1. th la nganh kh tiet 1Bai 1. th la nganh kh tiet 1
Bai 1. th la nganh kh tiet 1
 
Nota 1 bahagian luar ikan hiasan
Nota 1 bahagian luar ikan hiasanNota 1 bahagian luar ikan hiasan
Nota 1 bahagian luar ikan hiasan
 
Tinkerer for pyfes 201303
Tinkerer for pyfes 201303Tinkerer for pyfes 201303
Tinkerer for pyfes 201303
 
Ansible meetup201409
Ansible meetup201409Ansible meetup201409
Ansible meetup201409
 
EdisonでMQTT
EdisonでMQTTEdisonでMQTT
EdisonでMQTT
 
MQTT meetup in Tokyo 機能概要
MQTT meetup in Tokyo 機能概要MQTT meetup in Tokyo 機能概要
MQTT meetup in Tokyo 機能概要
 
Hot and cold data storage
Hot and cold data storageHot and cold data storage
Hot and cold data storage
 
Amazing Things: Third-Party Python Package Ecosystems
Amazing Things: Third-Party Python Package EcosystemsAmazing Things: Third-Party Python Package Ecosystems
Amazing Things: Third-Party Python Package Ecosystems
 
Kiwi PyCon 2011 - Audrey Roy Keynote Speech
Kiwi PyCon 2011 - Audrey Roy Keynote SpeechKiwi PyCon 2011 - Audrey Roy Keynote Speech
Kiwi PyCon 2011 - Audrey Roy Keynote Speech
 
Ansible入門...?
Ansible入門...?Ansible入門...?
Ansible入門...?
 
Ansible overview
Ansible overviewAnsible overview
Ansible overview
 
Red Hat JBoss Middleware Portfolio
Red Hat JBoss Middleware PortfolioRed Hat JBoss Middleware Portfolio
Red Hat JBoss Middleware Portfolio
 
QCon 2015 - DevOps, Chef, Puppet e Ansible e como vender milhões na Black Fri...
QCon 2015 - DevOps, Chef, Puppet e Ansible e como vender milhões na Black Fri...QCon 2015 - DevOps, Chef, Puppet e Ansible e como vender milhões na Black Fri...
QCon 2015 - DevOps, Chef, Puppet e Ansible e como vender milhões na Black Fri...
 

Similar to Ansible for beginners ...?

Puppet Troubleshooting
Puppet TroubleshootingPuppet Troubleshooting
Puppet Troubleshooting
Puppet
 
JavaScript (without DOM)
JavaScript (without DOM)JavaScript (without DOM)
JavaScript (without DOM)
Piyush Katariya
 

Similar to Ansible for beginners ...? (20)

Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
Practical Celery
Practical CeleryPractical Celery
Practical Celery
 
BUILDING APPS WITH ASYNCIO
BUILDING APPS WITH ASYNCIOBUILDING APPS WITH ASYNCIO
BUILDING APPS WITH ASYNCIO
 
Effective testing with pytest
Effective testing with pytestEffective testing with pytest
Effective testing with pytest
 
Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18
 
Django Celery
Django Celery Django Celery
Django Celery
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
Python and Machine Learning
Python and Machine LearningPython and Machine Learning
Python and Machine Learning
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
Puppet Troubleshooting
Puppet TroubleshootingPuppet Troubleshooting
Puppet Troubleshooting
 
Troubleshooting Puppet
Troubleshooting PuppetTroubleshooting Puppet
Troubleshooting Puppet
 
JavaScript (without DOM)
JavaScript (without DOM)JavaScript (without DOM)
JavaScript (without DOM)
 
Puppi. Puppet strings to the shell
Puppi. Puppet strings to the shellPuppi. Puppet strings to the shell
Puppi. Puppet strings to the shell
 
Python profiling
Python profilingPython profiling
Python profiling
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?
 
Tasks: you gotta know how to run them
Tasks: you gotta know how to run themTasks: you gotta know how to run them
Tasks: you gotta know how to run them
 
Testing My Patience
Testing My PatienceTesting My Patience
Testing My Patience
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
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
vu2urc
 

Recently uploaded (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
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
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 

Ansible for beginners ...?