SlideShare a Scribd company logo
1 of 22
Keep InfraCode simple
with Ansible
Introduction and best practices
jmolero@know-center.at José Manuel Molero
@jmlero Infracoders Meetup
Graz, 11.04.2017
1
>ls –l presentation
oIntroduction
oAnsible
• About
• Inventory
• Playbooks
• Roles
• Advices
oDemo
2
>whoami
oSystems Engineer with 8 years of experience
• Linux environments. Compute clusters. Cloud. Big Data.
Open source software
oFrom Almería (Spain)
o2014 - Wien
• CeMM - Research Center for Molecular Medicine
o2016 - Graz
• Know-Center
• www.know-center.at
@jmlero linkedin.com/in/jmolero github.com/jmlero 3
© Know-Center GmbH • Research Center for Data-Driven Business and Big Data Analytics • 2017
KNOW-CENTER GMBH
Austria's leading research center for
Data-driven Business und Big Data Analytics
* COMET is an Austrian funding program
that supports a sustainable knowledge
transfer from science to industry.
> 80 Researchers
> 600 COMET* & industrial projects
> 30 international EU projects
Founded in 2001
Located at the Technical University of Graz
4
© Know-Center GmbH • Research Center for Data-Driven Business and Big Data Analytics • 2017
Big Data Lab
We help you to gain insights from your data!
CONSULTING DATA ANALYTICS TRAINING
DATA ACQUISITION
Formats, Standards &
Legal issues
PREPARATION
Cleaning, Normalizing, Integration &
Loading
(DISTRIBUTED) ANALYTICS
Utilizing our Hadoop Cluster or other
cloud-based solution
BIG DATA INTRODUCTION
Concepts, Methods, Technologies and
tools around Big Data
DATA VALUE CHECK
Feasibility study about kind, volume and
quality of your data
DATA-DRIVEN BUSINESS
Identifying new business models that can
be added to your value chain
BIG DATA FOR DEVELOPERS
Utilizing the Apache Hadoop ecosystem
for Big Data Analytics
APACHE HADOOP ESSENTIALS
Setup and administration of
Apache Hadoop Clusters
DATA ANALYTICS FUNDAMENTALS
Basics of Data Science and
Machine Learning
5
Disclaimer
o Ansible is a great tool
• But is not perfect
• With pros and cons
o And is not the only tool
• Also learning chef and puppet
o (Unfortunately) Ansible Inc doesn’t pay me
• Focus only on the open source side of the project
6
>vim Ansible/Readme.md
oAnsible is an open source automation tool for (cloud) provisioning,
application deployment, and configuration management
oAcquired by RedHat in 2015
• https://www.redhat.com/en/about/blog/why-red-hat-acquired-ansible
oThe name "Ansible" references a fictional instantaneous
hyperspace communication system (as featured in Orson Scott
Card's Ender's Game)
7
But why Ansible
Simple Powerful Agentless
Radically simple
Easy to read
Easy to start
Designed for multi-tier
developments
Cloud provisioning
Deploy everywhere
from everywhere
Minimal requirements
Agentless architecture
Reliable and secure
8
>diff Ansible Chef Puppet
Ansible Chef Puppet
Initial release 2012
Push
Agentless and Masterless
Playbook
YAML (+Jinja2 templates)
Initial release 2009
Pull
Master/Client
Recipe
Ruby DSL
Initial release 2005
Pull
Master/Client
Manifest
Custom
9
Schema
Infrastructure as a Code
Inventory
Playbooks
SSH
SSH
10
>man inventory
oDescription of the nodes that can be managed by Ansible
11
Hello world (v0.1)
>yum install ansible
>ansible localhost -a “yum install httpd –y; systemctl start httpd”
12
>help modules
oAnsible comes with hundred of modules
• http://docs.ansible.com/ansible/list_of_all_modules.html
oAvoid using commands
• Modules command and shell as last resort
oModules return reports as JSON
• State, changes, info
• Easier to manage and debug
13
Hello world (v0.2)
>yum install ansible
>ansible localhost –m yum -a “state=present name=httpd”
>ansible localhost –m service -a “state=started name=httpd”
14
>ansible-playbook -h
o Playbooks express configurations,
deployment and orchestration
o The Playbook format is YAML
o Each Playbook maps a group of hosts to a
set of roles
• Each role is represented by calls to Ansible tasks
15
Hello world (2) (v0.3)
>vim hello_world.yml
---
- hosts: localhost
tasks:
- name: Install apache2
yum:
name: httpd
state: latest
notify:
- start apache
handlers:
- name: start apache
service:
name: httpd
state: started
>ansible-playbook hello_world.yml
16
Playbooks_roles
o Playbooks composed by tasks and handlers
o How to organize your playbooks?
• Use roles
o Roles are ways of automatically load certain vars_files, tasks, and
handlers based on a known file structure
17
>tree ansible_playbooks
>ansible-galaxy init
18
>git commit –a
o If you can make it simple, make it simple
o If something feels complicated, it probably is (back to number 1)
o Use simple, small and focused roles
o Make it readable (for you after 1 year)
o YAML files. Not much documentation required
o Auto-descriptive playbooks, files, variables and tasks
o Always define state (latest, present, absent)
o Native YAML style (but is not mandatory)
o Editor (syntax highlight) (atom, sublime, vscode)
o Version control
19
>demo.exe (monitoring platform)
Infrastructure as a Code
Inventory
Playbooks
es-server
client01
metricbeats elasticsearch kibana
20
github.com/jmlero
The elastic stack
21
Vielen Dank für Ihre Aufmerksamkeit
Insert: any_question.jpg
jmolero@know-center.at José Manuel Molero
@jmlero Infracoders Meetup
Graz, 11.04.2017
22

More Related Content

Similar to Introduction to Ansible. Meetup Infracoders

Puppet for SysAdmins
Puppet for SysAdminsPuppet for SysAdmins
Puppet for SysAdminsPuppet
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101APNIC
 
Apache pig as a researcher’s stepping stone
Apache pig as a researcher’s stepping stoneApache pig as a researcher’s stepping stone
Apache pig as a researcher’s stepping stonebenosteen
 
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 Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides InfinityPP
 
Defending Your Network
Defending Your NetworkDefending Your Network
Defending Your NetworkAdam Getchell
 
Ansible nice-pdf-copy-for-pres
Ansible nice-pdf-copy-for-presAnsible nice-pdf-copy-for-pres
Ansible nice-pdf-copy-for-presManmohan Singh
 
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 AnsibleBenjamin Zores
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftYaniv cohen
 
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)Chu-Siang Lai
 
2016 - Open Mic - IGNITE - Open Infrastructure = ANY Infrastructure
2016 - Open Mic - IGNITE - Open Infrastructure = ANY Infrastructure2016 - Open Mic - IGNITE - Open Infrastructure = ANY Infrastructure
2016 - Open Mic - IGNITE - Open Infrastructure = ANY Infrastructuredevopsdaysaustin
 
OpenStack Preso: DevOps on Hybrid Infrastructure
OpenStack Preso: DevOps on Hybrid InfrastructureOpenStack Preso: DevOps on Hybrid Infrastructure
OpenStack Preso: DevOps on Hybrid Infrastructurerhirschfeld
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modulesmohamedmoharam
 

Similar to Introduction to Ansible. Meetup Infracoders (20)

ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Puppet for SysAdmins
Puppet for SysAdminsPuppet for SysAdmins
Puppet for SysAdmins
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101
 
Apache pig as a researcher’s stepping stone
Apache pig as a researcher’s stepping stoneApache pig as a researcher’s stepping stone
Apache pig as a researcher’s stepping stone
 
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 Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides
 
Ansible.pdf
Ansible.pdfAnsible.pdf
Ansible.pdf
 
Defending Your Network
Defending Your NetworkDefending Your Network
Defending Your Network
 
Ansible
AnsibleAnsible
Ansible
 
PyData Boston 2013
PyData Boston 2013PyData Boston 2013
PyData Boston 2013
 
Ansible nice-pdf-copy-for-pres
Ansible nice-pdf-copy-for-presAnsible nice-pdf-copy-for-pres
Ansible nice-pdf-copy-for-pres
 
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 intro
Ansible introAnsible intro
Ansible intro
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
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)
 
2016 - Open Mic - IGNITE - Open Infrastructure = ANY Infrastructure
2016 - Open Mic - IGNITE - Open Infrastructure = ANY Infrastructure2016 - Open Mic - IGNITE - Open Infrastructure = ANY Infrastructure
2016 - Open Mic - IGNITE - Open Infrastructure = ANY Infrastructure
 
OpenStack Preso: DevOps on Hybrid Infrastructure
OpenStack Preso: DevOps on Hybrid InfrastructureOpenStack Preso: DevOps on Hybrid Infrastructure
OpenStack Preso: DevOps on Hybrid Infrastructure
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
 

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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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 RobisonAnna Loughnan Colquhoun
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Introduction to Ansible. Meetup Infracoders

  • 1. Keep InfraCode simple with Ansible Introduction and best practices jmolero@know-center.at José Manuel Molero @jmlero Infracoders Meetup Graz, 11.04.2017 1
  • 2. >ls –l presentation oIntroduction oAnsible • About • Inventory • Playbooks • Roles • Advices oDemo 2
  • 3. >whoami oSystems Engineer with 8 years of experience • Linux environments. Compute clusters. Cloud. Big Data. Open source software oFrom Almería (Spain) o2014 - Wien • CeMM - Research Center for Molecular Medicine o2016 - Graz • Know-Center • www.know-center.at @jmlero linkedin.com/in/jmolero github.com/jmlero 3
  • 4. © Know-Center GmbH • Research Center for Data-Driven Business and Big Data Analytics • 2017 KNOW-CENTER GMBH Austria's leading research center for Data-driven Business und Big Data Analytics * COMET is an Austrian funding program that supports a sustainable knowledge transfer from science to industry. > 80 Researchers > 600 COMET* & industrial projects > 30 international EU projects Founded in 2001 Located at the Technical University of Graz 4
  • 5. © Know-Center GmbH • Research Center for Data-Driven Business and Big Data Analytics • 2017 Big Data Lab We help you to gain insights from your data! CONSULTING DATA ANALYTICS TRAINING DATA ACQUISITION Formats, Standards & Legal issues PREPARATION Cleaning, Normalizing, Integration & Loading (DISTRIBUTED) ANALYTICS Utilizing our Hadoop Cluster or other cloud-based solution BIG DATA INTRODUCTION Concepts, Methods, Technologies and tools around Big Data DATA VALUE CHECK Feasibility study about kind, volume and quality of your data DATA-DRIVEN BUSINESS Identifying new business models that can be added to your value chain BIG DATA FOR DEVELOPERS Utilizing the Apache Hadoop ecosystem for Big Data Analytics APACHE HADOOP ESSENTIALS Setup and administration of Apache Hadoop Clusters DATA ANALYTICS FUNDAMENTALS Basics of Data Science and Machine Learning 5
  • 6. Disclaimer o Ansible is a great tool • But is not perfect • With pros and cons o And is not the only tool • Also learning chef and puppet o (Unfortunately) Ansible Inc doesn’t pay me • Focus only on the open source side of the project 6
  • 7. >vim Ansible/Readme.md oAnsible is an open source automation tool for (cloud) provisioning, application deployment, and configuration management oAcquired by RedHat in 2015 • https://www.redhat.com/en/about/blog/why-red-hat-acquired-ansible oThe name "Ansible" references a fictional instantaneous hyperspace communication system (as featured in Orson Scott Card's Ender's Game) 7
  • 8. But why Ansible Simple Powerful Agentless Radically simple Easy to read Easy to start Designed for multi-tier developments Cloud provisioning Deploy everywhere from everywhere Minimal requirements Agentless architecture Reliable and secure 8
  • 9. >diff Ansible Chef Puppet Ansible Chef Puppet Initial release 2012 Push Agentless and Masterless Playbook YAML (+Jinja2 templates) Initial release 2009 Pull Master/Client Recipe Ruby DSL Initial release 2005 Pull Master/Client Manifest Custom 9
  • 10. Schema Infrastructure as a Code Inventory Playbooks SSH SSH 10
  • 11. >man inventory oDescription of the nodes that can be managed by Ansible 11
  • 12. Hello world (v0.1) >yum install ansible >ansible localhost -a “yum install httpd –y; systemctl start httpd” 12
  • 13. >help modules oAnsible comes with hundred of modules • http://docs.ansible.com/ansible/list_of_all_modules.html oAvoid using commands • Modules command and shell as last resort oModules return reports as JSON • State, changes, info • Easier to manage and debug 13
  • 14. Hello world (v0.2) >yum install ansible >ansible localhost –m yum -a “state=present name=httpd” >ansible localhost –m service -a “state=started name=httpd” 14
  • 15. >ansible-playbook -h o Playbooks express configurations, deployment and orchestration o The Playbook format is YAML o Each Playbook maps a group of hosts to a set of roles • Each role is represented by calls to Ansible tasks 15
  • 16. Hello world (2) (v0.3) >vim hello_world.yml --- - hosts: localhost tasks: - name: Install apache2 yum: name: httpd state: latest notify: - start apache handlers: - name: start apache service: name: httpd state: started >ansible-playbook hello_world.yml 16
  • 17. Playbooks_roles o Playbooks composed by tasks and handlers o How to organize your playbooks? • Use roles o Roles are ways of automatically load certain vars_files, tasks, and handlers based on a known file structure 17
  • 19. >git commit –a o If you can make it simple, make it simple o If something feels complicated, it probably is (back to number 1) o Use simple, small and focused roles o Make it readable (for you after 1 year) o YAML files. Not much documentation required o Auto-descriptive playbooks, files, variables and tasks o Always define state (latest, present, absent) o Native YAML style (but is not mandatory) o Editor (syntax highlight) (atom, sublime, vscode) o Version control 19
  • 20. >demo.exe (monitoring platform) Infrastructure as a Code Inventory Playbooks es-server client01 metricbeats elasticsearch kibana 20 github.com/jmlero
  • 22. Vielen Dank für Ihre Aufmerksamkeit Insert: any_question.jpg jmolero@know-center.at José Manuel Molero @jmlero Infracoders Meetup Graz, 11.04.2017 22

Editor's Notes

  1. GRAFISCH mit Know-Center Icons!