32
INFRASTRUCTURE AUTOMATION WITH CHEF & ANSIBLE Tips & tools for automating your web infrastructure. Waqar Alamgir @wajrcs https://github.com/waqar-alamgir/tutorials/tree/master/vagrant- lamp-ansible

Infrastructure Automation with Chef & Ansible

  • Upload
    wajrcs

  • View
    2.036

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Infrastructure Automation with Chef & Ansible

INFRASTRUCTURE AUTOMATIONWITH CHEF & ANSIBLE

Tips & tools for automating your web infrastructure.

Waqar Alamgir @wajrcshttps://github.com/waqar-alamgir/tutorials/tree/master/vagrant-lamp-ansible

Page 2: Infrastructure Automation with Chef & Ansible

Here’s What I’m Going To Talk To You About! What is Infrastructure and why you should

automate it? Typical Infrastructure Benefits CMS/ Automation Chef / Terminologies / Disadvantages Ansible / Disadvantages Demo Summary Questions

Page 3: Infrastructure Automation with Chef & Ansible

Meet this IT GUY & Service Provider

Page 4: Infrastructure Automation with Chef & Ansible

Why you should automate your web infrastructure All of your configuration information is in

one place. You can spin up perfectly configured

servers instantly. You can change things in one place and

have them propagate through your entire system.

You can create dev and test environments, that are exact replicas of your production.

Page 5: Infrastructure Automation with Chef & Ansible

Infrastructure A high performance, reliable, and secure integrated technology infrastructure for managing multiple hosted applications by Application Service Providers.

Application infrastructure, comprised of application servers, web servers, and often database servers, is a core component in most network architectures.

Page 6: Infrastructure Automation with Chef & Ansible

Typical Infrastructure

Page 7: Infrastructure Automation with Chef & Ansible
Page 8: Infrastructure Automation with Chef & Ansible

Benefits Technical benefits:

Continuous software delivery Less complex problems to fix Faster resolution of problems

Business benefits: Faster delivery of features More stable operating environments More time available to add value (rather than

fix/maintain)

Page 9: Infrastructure Automation with Chef & Ansible

PHP Nginx Redis PostgreSQL Gearman

My Typical Project

Page 10: Infrastructure Automation with Chef & Ansible
Page 11: Infrastructure Automation with Chef & Ansible

Configuration Management Software Ansible Chef Puppet SaltStack CFEngine Juju many others

Page 12: Infrastructure Automation with Chef & Ansible

What is Chef?

“Reality-based automation for the cloud.”

“Infrastructure as Code.”“A global view of your system as opposed to

local one”

Page 13: Infrastructure Automation with Chef & Ansible

TerminologiesChef Server? Central storage for all your chef config. Stores all your git repo stuff as structured

data in json. Uses CouchDB for storage and quering Hosted Chef free for up to 5 nodes – then

you should host it yourself.

Page 14: Infrastructure Automation with Chef & Ansible

TerminologiesKnife?Command line tool to interface between your local code repo and your chef server.

Page 15: Infrastructure Automation with Chef & Ansible

TerminologiesNodes?Servers in your system.

Page 16: Infrastructure Automation with Chef & Ansible

TerminologiesRoles?A nice way of abstracting what a node does and what should be installed on it. i.e. A webserver role A database role

Open up firewall for front-end severs.

Page 17: Infrastructure Automation with Chef & Ansible

TerminologiesCookbooks?The base unit of configuration, so you would have a cookbook for nginx, postgres, gunicorn, etc.

Page 18: Infrastructure Automation with Chef & Ansible

TerminologiesRecipes?A computer program that runs cookbooksMostly written in Ruby or Python

Page 19: Infrastructure Automation with Chef & Ansible

Chef Infrastructure

Page 20: Infrastructure Automation with Chef & Ansible

Chef Infrastructure

Page 21: Infrastructure Automation with Chef & Ansible

Chef disadvantages You need to know Ruby (infrastructure as

code) Need to install Chef Client on nodes Chef Client can be broken (example,

Rubygems Sandbox in 11/12 versions) Different teams with different approaches Documentation is not perfect Too many tools and options

Page 22: Infrastructure Automation with Chef & Ansible

Who is Using Chef Facebook, with over 20K instances Yahoo! IGN Nordstrom Dream Host Target Bloomberg

Page 23: Infrastructure Automation with Chef & Ansible

Ansible Runs locally (push model, like Chef Solo) Client-less (need only Python) YAML configs, "command to infrastructure" Huge community Ansible Tower for more automation

Page 24: Infrastructure Automation with Chef & Ansible

Ansible Infrastructure

Page 25: Infrastructure Automation with Chef & Ansible

Ansible disadvantages Bad team workflow Small flexibility in coding Poor development testing Limited support for Windows

(from 1.7 can use winrm, but still not perfect and small amount of modules)

Page 26: Infrastructure Automation with Chef & Ansible

Who is Using Ansible Twitter Apple NASA CISCO Juniper HootSuit

Page 27: Infrastructure Automation with Chef & Ansible

Demo Application - LAMP StackProvision Theme

Common system level tools MySQL, Memcached, Beanstalk Web tools as Apache, PHP

Page 28: Infrastructure Automation with Chef & Ansible

Demo Application - LAMP Stack

Page 29: Infrastructure Automation with Chef & Ansible

Demo Application - LAMP Stack

Page 30: Infrastructure Automation with Chef & Ansible

Demo Application - LAMP Stack

Page 31: Infrastructure Automation with Chef & Ansible

To Sum it all up…. You should really, really, really use

something for server configuration. Chef: Ruby code to infrastructure. Ansible: YAML commands to infrastructure,

with no clients.