SlideShare a Scribd company logo
1 of 21
@magma_digital
Orchestrate your Infrastructure
Magma Digital Ltd
Jeremy Coates
@magma_digital
Who am I?๏ Jeremy Coates, MD at Magma Digital Ltd
๏ Founder of PHPNW
๏ Manchester Digital Association Council
Member
๏ @phpcodemonkey
๏ linkedin.com/in/jeremycoates
@magma_digital
What is
Ansible?
SALT CHEFPUPPET Ansible
@magma_digital
Why
use it?
@magma_digital
Install:Controller
๏ Only install on controller machine
๏ Requires: Python 2.6+, Paramiko (ssh), PyYAML, Jinja2
๏ RedHat: yum install ansible
๏ Debian: apt-get install ansible
๏ OS X: brew install ansible
๏ All: pip install ansible or from source
@magma_digital
Install:Remotes
๏ Nothing much!
๏ SSH server
๏ Python 2.4+ and simplejson module
๏ Or just Python 2.6+
๏ Essentially any *nix distro in last decade
@magma_digital
First 10 minutes
๏ Command line usage:
• ansible -i hosts -m ping all
• ansible webserver -m setup
• ansible -i /path/to/hosts -m <module>
[options e.g -vvvv] <host pattern>
• Default checks /etc/ansible/hosts
• -- check && -- diff
@magma_digital
Inventory: Hosts
[webservers]
web ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant
ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
web2 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2201
ansible_ssh_user=vagrant
ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
[dbservers]
db ansible_ssh_host=127.0.0.1 ansible_ssh_port=2202 ansible_ssh_user=vagrant
ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
@magma_digital
Inventory:Dynamic hosts
๏ Plugin scripts for:
• Amazon EC2
• Digital Ocean
• Linode
• Vagrant
• + others
๏ Or create your own CMDB (Configuration Management DB)
@magma_digital
Playbooks๏ Commandline doesn’t scale: Playbooks do
๏ Playbooks are YAML
๏ ansible-playbook -i hosts playbook.yml
@magma_digital
Sample Playbook
---
- hosts: localhost
user: root
vars:
motd_warning: 'WARNING: Use by ACME Employees ONLY'
tasks:
- name: setup a MOTD
copy: dest=/etc/motd content={{ motd_warning }}
@magma_digital
Playbooks๏ Language of playbooks relatively familiar to devs
๏ Targets - groups of tasks / vars etc.
๏ Vars - nice and obvious!
๏ Tasks - actions using modules / vars
๏ Includes - re-usable components
@magma_digital
Playbooks Speed
๏ Playbooks default to 5 forks
• -- forks <N> to vary this
๏ async: <seconds> for long running processes
๏ poll: <seconds> check the progress
๏ Tags: target sections of play books
๏ Roles: convention to enable reuse of playbooks
@magma_digital
Playbooks…๏ Looping: with_items:, with_fileglob:
๏ Conditional processing: when: ansible_os_family == ‘RedHat’
๏ Task Delegation: delegate_to: <host> or local_action:
shorthand
๏ Vars: hostvars, groups, inventory*, environment
@magma_digital
Playbook Templates
๏ Jinja2 template engine. Has access to any ansible facts
(vars)
๏ Comments: {# a comment #}
๏ If/else: {% if 'authorativenames' in group_names %} {% else
%} {% endif %}
๏ Loops: {% for ip in ansible_all_ipv4_addresses %} {% end
for %}
@magma_digital
Modules๏ Over 100 modules already exist
• Swiss army knife of machine management: ansible-doc
๏ Write own modules in any language, including PHP
(json_encode)
๏ Module output key=value or JSON
@magma_digital
Ansible-pull
๏ Runs on the machine to be configured
๏ Larger deployments (auto-scaling server farms etc.)
๏ Auto-update when repo changes
๏ Requires cron
@magma_digital
SHARE REUSEENHANCE
@magma_digital
Related?๏ ansible-vault - encryption for sensitive yaml files
๏ Ansible Guru - support subscription ($99/month)
๏ Ansible Tower (AWX) - commercial version
• Web console, REST API
• 50 machines from $2500/year (depending on support level
needed)
๏ Vagrant - Ansible provisioner module
@magma_digital
ResourcesWebsite: ansible.com
Documentation: docs.ansible.com
Twitter: @ansible
IRC: #ansible (freenode)
Google Group: ansible-project
Reddit: reddit.com/r/ansible
Ansible Weekly Newsletter: devopsu.com
Ansible Configuration Management:
(Daniel Hall: Packt Publishing Nov ’13 ISBN 978-1-78328-081-0)
@magma_digital
๏ Jeremy Coates, MD at Magma Digital Ltd
๏ Founder of PHPNW
๏ Manchester Digital Association Council Member
๏ @phpcodemonkey
๏ linkedin.com/in/jeremycoates
http://bit.ly/orchestrate_infrastructure
Simply Orchestratehttps://joind.in/11296

More Related Content

Viewers also liked

El argentino n# 2625 01 3-121
El argentino n# 2625 01 3-121El argentino n# 2625 01 3-121
El argentino n# 2625 01 3-121fede_bour
 
International coordinator performance appraisal
International coordinator performance appraisalInternational coordinator performance appraisal
International coordinator performance appraisalFrancescoTotti012
 
Hotelopia white label email proposal
Hotelopia white label email proposalHotelopia white label email proposal
Hotelopia white label email proposalXisco Amer
 
OtterBox Alpha Glass Reviewer's Guide
OtterBox Alpha Glass Reviewer's GuideOtterBox Alpha Glass Reviewer's Guide
OtterBox Alpha Glass Reviewer's GuideOtterBoxPR
 
La trasparenza come controllo sociale.
La  trasparenza come controllo sociale.La  trasparenza come controllo sociale.
La trasparenza come controllo sociale.Laura Strano
 
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016ManageIQ
 
Orchestrate Event-Driven Infrastructure with SaltStack
Orchestrate Event-Driven Infrastructure with SaltStackOrchestrate Event-Driven Infrastructure with SaltStack
Orchestrate Event-Driven Infrastructure with SaltStackLove Nyberg
 
Presentacio eportfoli IOC
Presentacio eportfoli IOCPresentacio eportfoli IOC
Presentacio eportfoli IOCJoan Queralt
 
LinuxCon 2015 Stateful NAT with OVS
LinuxCon 2015 Stateful NAT with OVSLinuxCon 2015 Stateful NAT with OVS
LinuxCon 2015 Stateful NAT with OVSThomas Graf
 
2015 FOSDEM - OVS Stateful Services
2015 FOSDEM - OVS Stateful Services2015 FOSDEM - OVS Stateful Services
2015 FOSDEM - OVS Stateful ServicesThomas Graf
 
Biología del Cáncer Robert Weinberg presentacion capitulos 12 - 16
Biología del Cáncer Robert Weinberg presentacion capitulos 12 - 16Biología del Cáncer Robert Weinberg presentacion capitulos 12 - 16
Biología del Cáncer Robert Weinberg presentacion capitulos 12 - 16Ivan Falconi
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with CodeceptionJeremy Coates
 

Viewers also liked (18)

El argentino n# 2625 01 3-121
El argentino n# 2625 01 3-121El argentino n# 2625 01 3-121
El argentino n# 2625 01 3-121
 
Diagnóstico territorial de la exportación La Rioja
Diagnóstico territorial de la exportación La RiojaDiagnóstico territorial de la exportación La Rioja
Diagnóstico territorial de la exportación La Rioja
 
International coordinator performance appraisal
International coordinator performance appraisalInternational coordinator performance appraisal
International coordinator performance appraisal
 
Octocam
OctocamOctocam
Octocam
 
Hotelopia white label email proposal
Hotelopia white label email proposalHotelopia white label email proposal
Hotelopia white label email proposal
 
OtterBox Alpha Glass Reviewer's Guide
OtterBox Alpha Glass Reviewer's GuideOtterBox Alpha Glass Reviewer's Guide
OtterBox Alpha Glass Reviewer's Guide
 
Feria Julio 2014 Valencia
Feria Julio 2014 ValenciaFeria Julio 2014 Valencia
Feria Julio 2014 Valencia
 
SUNRISE CITY
SUNRISE CITYSUNRISE CITY
SUNRISE CITY
 
Mira Centro Óptico
Mira Centro ÓpticoMira Centro Óptico
Mira Centro Óptico
 
La trasparenza come controllo sociale.
La  trasparenza come controllo sociale.La  trasparenza come controllo sociale.
La trasparenza come controllo sociale.
 
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
 
Orchestrate Event-Driven Infrastructure with SaltStack
Orchestrate Event-Driven Infrastructure with SaltStackOrchestrate Event-Driven Infrastructure with SaltStack
Orchestrate Event-Driven Infrastructure with SaltStack
 
Why is PHP Awesome
Why is PHP AwesomeWhy is PHP Awesome
Why is PHP Awesome
 
Presentacio eportfoli IOC
Presentacio eportfoli IOCPresentacio eportfoli IOC
Presentacio eportfoli IOC
 
LinuxCon 2015 Stateful NAT with OVS
LinuxCon 2015 Stateful NAT with OVSLinuxCon 2015 Stateful NAT with OVS
LinuxCon 2015 Stateful NAT with OVS
 
2015 FOSDEM - OVS Stateful Services
2015 FOSDEM - OVS Stateful Services2015 FOSDEM - OVS Stateful Services
2015 FOSDEM - OVS Stateful Services
 
Biología del Cáncer Robert Weinberg presentacion capitulos 12 - 16
Biología del Cáncer Robert Weinberg presentacion capitulos 12 - 16Biología del Cáncer Robert Weinberg presentacion capitulos 12 - 16
Biología del Cáncer Robert Weinberg presentacion capitulos 12 - 16
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with Codeception
 

More from Jeremy Coates

Cyber Security and GDPR
Cyber Security and GDPRCyber Security and GDPR
Cyber Security and GDPRJeremy Coates
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented ProgrammingJeremy Coates
 
An introduction to Phing the PHP build system (PHPDay, May 2012)
An introduction to Phing the PHP build system (PHPDay, May 2012)An introduction to Phing the PHP build system (PHPDay, May 2012)
An introduction to Phing the PHP build system (PHPDay, May 2012)Jeremy Coates
 
An introduction to Phing the PHP build system
An introduction to Phing the PHP build systemAn introduction to Phing the PHP build system
An introduction to Phing the PHP build systemJeremy Coates
 
Insects in your mind
Insects in your mindInsects in your mind
Insects in your mindJeremy Coates
 
Hudson Continuous Integration for PHP
Hudson Continuous Integration for PHPHudson Continuous Integration for PHP
Hudson Continuous Integration for PHPJeremy Coates
 
The Uncertainty Principle
The Uncertainty PrincipleThe Uncertainty Principle
The Uncertainty PrincipleJeremy Coates
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With PhpJeremy Coates
 
What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3Jeremy Coates
 
Mysql Explain Explained
Mysql Explain ExplainedMysql Explain Explained
Mysql Explain ExplainedJeremy Coates
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version ControlJeremy Coates
 
PHPNW Conference Update
PHPNW Conference UpdatePHPNW Conference Update
PHPNW Conference UpdateJeremy Coates
 

More from Jeremy Coates (16)

Cyber Security and GDPR
Cyber Security and GDPRCyber Security and GDPR
Cyber Security and GDPR
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
 
An introduction to Phing the PHP build system (PHPDay, May 2012)
An introduction to Phing the PHP build system (PHPDay, May 2012)An introduction to Phing the PHP build system (PHPDay, May 2012)
An introduction to Phing the PHP build system (PHPDay, May 2012)
 
An introduction to Phing the PHP build system
An introduction to Phing the PHP build systemAn introduction to Phing the PHP build system
An introduction to Phing the PHP build system
 
Insects in your mind
Insects in your mindInsects in your mind
Insects in your mind
 
Phing
PhingPhing
Phing
 
Hudson Continuous Integration for PHP
Hudson Continuous Integration for PHPHudson Continuous Integration for PHP
Hudson Continuous Integration for PHP
 
The Uncertainty Principle
The Uncertainty PrincipleThe Uncertainty Principle
The Uncertainty Principle
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 
What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3
 
Kiss Phpnw08
Kiss Phpnw08Kiss Phpnw08
Kiss Phpnw08
 
Regex Basics
Regex BasicsRegex Basics
Regex Basics
 
Search Lucene
Search LuceneSearch Lucene
Search Lucene
 
Mysql Explain Explained
Mysql Explain ExplainedMysql Explain Explained
Mysql Explain Explained
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
 
PHPNW Conference Update
PHPNW Conference UpdatePHPNW Conference Update
PHPNW Conference Update
 

Recently uploaded

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
 
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 slidevu2urc
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
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 Takeoffsammart93
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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 WorkerThousandEyes
 
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
 
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 CVKhem
 
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.pdfsudhanshuwaghmare1
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Recently uploaded (20)

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
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
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
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Ansible: Orchestrate your Infrastructure