SlideShare a Scribd company logo
Ansible
Hsi-Kai Wang
o Introduction
o Install
o Inventory
o Ad-Hoc/CLI
o Playbook
Outline
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY2
o What
• Ansible is an IT automation tool. It can configure systems, deploy software, and orchestrate more
advanced IT tasks such as continuous deployments or zero downtime rolling updates.
o Current version
• Community: Ansible 2.2(stable), 2.3(devel)
• Enterprise: Ansible tower
o Feature
• SSH Protocol
• Agent-less (push mode)
• Idempotent
• Role defined
• DSL: YAML(yml), Jinja2(j2)
Introduction
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY3
https://www.ansible.com/
Workflow
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY4
control
playbook
managed
ad-hoc/cli
SSH
o Requirements
• Python 2.6, 2.7 for control
• Python 2.4, 2.5 for managed
o # method1: install via yum
centos:~ # yum install epel-release
centos:~ # yum install ansible
o # method2: install via pip
centos:~ # pip install ansible
Install
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY5
o Config Order
1. ANSIBLE_CONFIG environment variable
2. ./ansible.cfg
3. ~/.ansible.cfg
4. /etc/ansible/ansible.cfg
o control:~ # cat /etc/ansible/ansible.cfg
[defaults]
ansible_python_interpreter = /usr/bin/python2
nocows = 1
...
Config File
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY6
o Main command
• ansible
• ansible-playbook
• ansible-doc
o Other command
• ansible-galaxy
• ansible-pull
• ansible-console
• ansible-vault
Command
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY7
Inventory
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY8
Ref: http://docs.ansible.com/ansible/intro_inventory.html
host group
group of group
group variable
o control:~ # cat hosts
node1 ansible_ssh_host=192.168.0.11 ansible_ssh_user=root 
ansible_ssh_pass=password ansible_become_pass=password 
node2 ansible_ssh_host=192.168.0.12 ansible_ssh_user=root 
ansible_ssh_private_key_file=private_file
o # run ansible via ad-hoc
control:~ # ansible all -i hosts -m ping -vvv
control:~ # ansible node1 -i hosts -m command -a uptime
Ad-Hoc/CLI
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY9
module
host inventory
o Ansible Module
• http://docs.ansible.com/ansible/modules_by_category.html
Module
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY10
Module – setup (gather fact)
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY11
playbook content
---
- hosts: all
tasks:
- name: Hello World
shell: echo "hello world"
[
{host: "all”},
{
tasks: [
{ name: "Hello World",
shell: "echo "hello world“”}
]
}
]
YAML & JSON
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY12
Playbook - content
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY13
module
disable gather fact
Playbook - execute
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY14
Playbook - vars
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY15
Playbook - example
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY16
copy file from control to managed
loop
notify
condition
Playbook - roles
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY17
Directory Structure
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY18
Playbook - tags
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY19
Playbook - tasks
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY20
o Ansible
o Ansible Document
o Ansible: Up and Running
o 現代 IT 人一定要知道的 Ansible 自動化組態技巧
Reference
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY21
Thank you!
© 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY
@ruckuswirelessfacebook.com/ruckuswirelesswww.ruckuswireless.com
22

More Related Content

PDF
A quick intro to Ansible
PDF
Infrastructure = Code
PDF
IT Automation with Ansible
PDF
Ansible Automation to Rule Them All
PDF
Introducing Ansible
PDF
docker build with Ansible
PDF
Introduction to ansible
ODP
ansible why ?
A quick intro to Ansible
Infrastructure = Code
IT Automation with Ansible
Ansible Automation to Rule Them All
Introducing Ansible
docker build with Ansible
Introduction to ansible
ansible why ?

What's hot (20)

PDF
Ansible best practices
PPTX
Introduction to Ansible
PDF
Ansible Introduction - Ansible Brno #1 - David Karban
PDF
Ansible roles done right
PPTX
Ansible presentation
PDF
Ansible, best practices
PDF
Jenkins and ansible reference
PDF
Getting Started with Ansible
PPTX
Using Ansible Dynamic Inventory with Amazon EC2
PPT
Ansible presentation
PDF
Ansible - Introduction
PDF
Ansible is the simplest way to automate. MoldCamp, 2015
PPTX
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
PDF
Ansible 101
PDF
#OktoCampus - Workshop : An introduction to Ansible
PDF
Ansible introduction - XX Betabeers Galicia
PDF
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
PDF
Automation with ansible
PPT
Learn basic ansible using docker
PPTX
Ansible for beginners
Ansible best practices
Introduction to Ansible
Ansible Introduction - Ansible Brno #1 - David Karban
Ansible roles done right
Ansible presentation
Ansible, best practices
Jenkins and ansible reference
Getting Started with Ansible
Using Ansible Dynamic Inventory with Amazon EC2
Ansible presentation
Ansible - Introduction
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible 101
#OktoCampus - Workshop : An introduction to Ansible
Ansible introduction - XX Betabeers Galicia
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
Automation with ansible
Learn basic ansible using docker
Ansible for beginners
Ad

Viewers also liked (20)

PPTX
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
PDF
Du cycle en V à DevOps, en passant par agile - Normation
PPTX
An Introduction to Maven
PDF
Ansible loves Python, Python Philadelphia meetup
PDF
Network Automation: Ansible 102
PDF
Busque, Compare Y Si Encuentra Algo Mejor3
PDF
2016/01/04付 オリジナルiTunes週間トップソングトピックス
PDF
88L10 MARINE CERT
PDF
Krasjkurs i twitter. Forskningskommunikasjon i sosiale medier
PDF
Concorrencia geral UFPE 2014
PDF
All Tomorrow's Programs: New Modes of Librarian Engagement and Student Collab...
PDF
Outubro rosa 15.10
PPT
Outsourcing de exploración en Argentina
DOCX
QI, not QA
PDF
Estructura atómica 1º
PPTX
Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...
PDF
BubbleMap Application
PDF
2015/09/28付 オリジナルiTunes週間トップソングトピックス
PDF
Oxyplast Case Study in Trends Magazine
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Du cycle en V à DevOps, en passant par agile - Normation
An Introduction to Maven
Ansible loves Python, Python Philadelphia meetup
Network Automation: Ansible 102
Busque, Compare Y Si Encuentra Algo Mejor3
2016/01/04付 オリジナルiTunes週間トップソングトピックス
88L10 MARINE CERT
Krasjkurs i twitter. Forskningskommunikasjon i sosiale medier
Concorrencia geral UFPE 2014
All Tomorrow's Programs: New Modes of Librarian Engagement and Student Collab...
Outubro rosa 15.10
Outsourcing de exploración en Argentina
QI, not QA
Estructura atómica 1º
Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...
BubbleMap Application
2015/09/28付 オリジナルiTunes週間トップソングトピックス
Oxyplast Case Study in Trends Magazine
Ad

Similar to Ansible intro (20)

PDF
Ansible
PDF
Ansible101
PPTX
Intro to-ansible-sep7-meetup
PPTX
Ansible as configuration management tool for devops
PPTX
Basics of Ansible - Sahil Davawala
PPTX
Ansible
PDF
Ansible - Swiss Army Knife Orchestration
PDF
Ansible nice-pdf-copy-for-pres
PPTX
Introduction to ansible
PDF
Let's Get Acquainted: Ansible! / Symfony Camp UA 2014
PDF
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
PPTX
Ansible Network Automation session1
PDF
ansible_rhel.pdf
PDF
Ansible is the simplest way to automate. SymfonyCafe, 2015
PDF
Introduction to Ansible in RHEL- RHCE.pdf
PDF
Automating with ansible (part a)
PDF
Ansible_Basics_ppt.pdf
PPTX
Automating with ansible (Part A)
PPTX
SESSION Ansible how to deploy and push resources
PPTX
Hands on ansible
Ansible
Ansible101
Intro to-ansible-sep7-meetup
Ansible as configuration management tool for devops
Basics of Ansible - Sahil Davawala
Ansible
Ansible - Swiss Army Knife Orchestration
Ansible nice-pdf-copy-for-pres
Introduction to ansible
Let's Get Acquainted: Ansible! / Symfony Camp UA 2014
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Ansible Network Automation session1
ansible_rhel.pdf
Ansible is the simplest way to automate. SymfonyCafe, 2015
Introduction to Ansible in RHEL- RHCE.pdf
Automating with ansible (part a)
Ansible_Basics_ppt.pdf
Automating with ansible (Part A)
SESSION Ansible how to deploy and push resources
Hands on ansible

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation theory and applications.pdf
PDF
KodekX | Application Modernization Development
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Approach and Philosophy of On baking technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
MYSQL Presentation for SQL database connectivity
Understanding_Digital_Forensics_Presentation.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
MIND Revenue Release Quarter 2 2025 Press Release
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation theory and applications.pdf
KodekX | Application Modernization Development
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Approach and Philosophy of On baking technology
20250228 LYD VKU AI Blended-Learning.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Advanced methodologies resolving dimensionality complications for autism neur...

Ansible intro

  • 2. o Introduction o Install o Inventory o Ad-Hoc/CLI o Playbook Outline © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY2
  • 3. o What • Ansible is an IT automation tool. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates. o Current version • Community: Ansible 2.2(stable), 2.3(devel) • Enterprise: Ansible tower o Feature • SSH Protocol • Agent-less (push mode) • Idempotent • Role defined • DSL: YAML(yml), Jinja2(j2) Introduction © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY3 https://www.ansible.com/
  • 4. Workflow © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY4 control playbook managed ad-hoc/cli SSH
  • 5. o Requirements • Python 2.6, 2.7 for control • Python 2.4, 2.5 for managed o # method1: install via yum centos:~ # yum install epel-release centos:~ # yum install ansible o # method2: install via pip centos:~ # pip install ansible Install © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY5
  • 6. o Config Order 1. ANSIBLE_CONFIG environment variable 2. ./ansible.cfg 3. ~/.ansible.cfg 4. /etc/ansible/ansible.cfg o control:~ # cat /etc/ansible/ansible.cfg [defaults] ansible_python_interpreter = /usr/bin/python2 nocows = 1 ... Config File © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY6
  • 7. o Main command • ansible • ansible-playbook • ansible-doc o Other command • ansible-galaxy • ansible-pull • ansible-console • ansible-vault Command © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY7
  • 8. Inventory © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY8 Ref: http://docs.ansible.com/ansible/intro_inventory.html host group group of group group variable
  • 9. o control:~ # cat hosts node1 ansible_ssh_host=192.168.0.11 ansible_ssh_user=root ansible_ssh_pass=password ansible_become_pass=password node2 ansible_ssh_host=192.168.0.12 ansible_ssh_user=root ansible_ssh_private_key_file=private_file o # run ansible via ad-hoc control:~ # ansible all -i hosts -m ping -vvv control:~ # ansible node1 -i hosts -m command -a uptime Ad-Hoc/CLI © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY9 module host inventory
  • 10. o Ansible Module • http://docs.ansible.com/ansible/modules_by_category.html Module © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY10
  • 11. Module – setup (gather fact) © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY11 playbook content
  • 12. --- - hosts: all tasks: - name: Hello World shell: echo "hello world" [ {host: "all”}, { tasks: [ { name: "Hello World", shell: "echo "hello world“”} ] } ] YAML & JSON © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY12
  • 13. Playbook - content © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY13 module disable gather fact
  • 14. Playbook - execute © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY14
  • 15. Playbook - vars © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY15
  • 16. Playbook - example © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY16 copy file from control to managed loop notify condition
  • 17. Playbook - roles © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY17
  • 18. Directory Structure © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY18
  • 19. Playbook - tags © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY19
  • 20. Playbook - tasks © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY20
  • 21. o Ansible o Ansible Document o Ansible: Up and Running o 現代 IT 人一定要知道的 Ansible 自動化組態技巧 Reference © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY21
  • 22. Thank you! © 2016 BROCADE COMMUNICATIONS SYSTEMS, INC. INTERNAL USE ONLY @ruckuswirelessfacebook.com/ruckuswirelesswww.ruckuswireless.com 22