puppet vs. chef vs. ansible vs. salt - ness-tech.co.ilירועים 2015/devops... · •automation...

33
Ninja, choose your weapon! Puppet vs. Chef vs. Ansible vs. Salt

Upload: dinhnga

Post on 28-Jul-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Ninja, choose your weapon!

Puppet vs. Chef vs. Ansible vs. Salt

Page 2: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

DevOps isn’t about Tools

Page 3: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

DevOps is all about Tools

Or maybe:

"We shape our tools. And then our tools

shape us.”

Marshall McLuhan

Page 4: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Weapons of Mass

Configuration

• Manage configuration of thousands of

servers

• Automation and orchestration

• Infrastructure as Code

Page 5: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Tools vs. no Tools

vs.

Page 6: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

The Good Tool

• One you’re comfortable with :)

• Flexible

• Extendable

• Scalable

• Community-supported

• Integrate-able

Page 7: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Puppet

Since: 2005

Written in: Ruby

Developed by: Puppetlabs

Configuration: Puppet-specific declarative

language (json-like). Model-driven.

Manages: > 10 mln nodes (acc. to Puppetlabs)

Page 8: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Puppet

Puppet master

agent agent agent

XMLRPC over HTTPS

Page 9: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Puppet Concepts

Resources: files, services, packages,

users…

Facts: managed system properties

Manifests: Puppet programs

Classes: collections of resource

definitions

Modules: classes + accompanying data

Puppetforge.com: 3326 community

modules

Page 10: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Puppet Features

• Configuration Management

• Automatic Discovery (MCollective)

• Orchestration (MCollective)

• Provisioning (w/Foreman or Razor)

Page 11: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Puppet Code:

class ntp {

case $operatingsystem {

centos, redhat: {

$service_name = 'ntpd'

$conf_file = 'ntp.conf.el'

}

debian, ubuntu: {

$service_name = 'ntp'

$conf_file = 'ntp.conf.debian'

}

}

package { 'ntp':

ensure => installed,

}

file { 'ntp.conf':

path => '/etc/ntp.conf',

ensure => file,

require => Package['ntp'],

source => "/root/examples/answers/${conf_file}"

}

service { 'ntp':

name => $service_name,

ensure => running,

enable => true,

subscribe => File['ntp.conf'],

}

}

Page 12: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Puppet Web UI Options

• Puppet Enterprise (commercial)

• Foreman

• PuppetBoard ( reporting only )

Page 13: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Puppet in a Nutshell

• The Most Mature (of the four reviewed)

• ‘Pull’ mode of operation, but push also

supported

• Enterprise Features (Event Inspection,

Automatic Discovery, Access Control)

• Largest Ecosystem (Foreman,

PuppetBoard)

• A Language of its Own

• Less flexible

• Easy to start with, gets complicated

further along.

Page 14: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Chef

Since: 2009

Written in: Ruby+Erlang

Developed by: Chef ( formerly Opscode )

Configuration: pure Ruby DSL - procedural

Page 15: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Chef

Page 16: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Chef Concepts

Resources: files, services, packages, users…

Recipes: Chef programs

Cookbooks: recipes + accompanying data

Databags: global variables

supermarket.chef.io: 2061 cookbooks

Page 17: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Chef Code

case platform

when "ubuntu","debian"

default[:ntp][:service] = "ntp"

when "redhat","centos","fedora","scientific"

default[:ntp][:service] = "ntpd"

end

package "ntp" do

action [:install]

end

template "/etc/ntp.conf" do

source "ntp.conf.erb"

variables( :ntp_server => "time.nist.gov" )

notifies :restart, "service[ntpd]"

end

service "ntpd" do

action [:enable,:start]

end

Page 18: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Chef Web UI Options

• OpenSource WebUI - deprecated

• Enterprise Chef - commercial, basic

Page 19: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Chef in a Nutshell

• Flexible, powerful

• Enterprise Features (HA, Analytics, etc)

• Pure Ruby DSL

• Steep learning curve

• Push feature still in beta

Page 20: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Ansible

Since: 2012

Written in: Python

Developed by: Ansible Works inc.

Configuration: yaml

Motto: Simple IT Automation

Page 21: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Ansible

Controlling

machine

node node node

json over ssh

Agentless!!!

Page 22: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Ansible Concepts

• Inventory: a list of hosts and host groups

• Ad-hoc commands: ansible all -a "/bin/echo

hello"

• Playbooks: configuration scenarios

• Modules: control system resources and

execute commands. Can be written in any

language!

• Roles: playbook and accompanying data

• ansible-galaxy.com: 3124 roles

Page 23: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Ansible Code

hosts: all

#ntp service name defined in ntp.yml

vars_files: ntp.yml

tasks:

- name: Install ntp package

yum: name=ntp state=latest

sudo: yes

- name: Starting ntp service

service: name={{ ntp_service_name }} state=started

sudo: yes

Page 24: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Ansible Web UI

• Ansible Tower (commercial)

Page 25: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Ansible in a Nutshell

• Simple

• Lightweight

• Agentless (SSH)

• Windows support still immature.

• yaml DSL can be tricky to use

• Not the best performance. (Slow)

Page 26: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Salt

Since: 2011

Written in: Python

Developed by: SaltStack inc.

Configuration: yaml (with jinja for logic)

Motto: Speed, scalability and flexibility

Page 27: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Salt

master

minion minion minion

ZeroMq

Can also be masterless!

Page 28: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Salt Concepts

• Commands: salt '*' disk.usage

• Modules: control system resources and

execute commands. Can be written in Python

or Cython

• States: configuration scenarios

• Grains: facts about the managed nodes

• Pillars: globally accessed data

• Community Modules and State Trees:

saltstarters.org

Page 29: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Salt Code

# Include :download:`map file <map.jinja>` of OS-specific

package names and

# file paths. Values can be overridden using Pillar.

{% from "ntp/map.jinja" import ntp with context %}

ntp:

pkg.installed:

- name: {{ ntp.client }}

{% set ntp_conf_src = salt['pillar.get']('ntp:ntp_conf') -%}

{% if ntp_conf_src %}

ntp_conf:

file.managed:

- name: {{ ntp.ntp_conf }}

- template: jinja

- source: {{ ntp_conf_src }}

- require:

- pkg: ntp

{% endif %}

Page 30: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Salt Web UI

• Halite: free, in pre-alpha

Page 31: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Salt in a Nutshell

• Fast

• Super-scalable

• Easily Extensible (renderers, returners, etc)

• Python API

• Push mode by default

• In Active Development

• Free (although raw) web ui

Page 32: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Summary

• Puppet: features, WebUI, maturity -

• better for devs

• Chef: flexibility, Ruby

• better for devs

• Ansible: simplicity, agentless

• better for ops

• Salt: scalability, flexibility, robustness, Python,

• better for ops

Page 33: Puppet vs. Chef vs. Ansible vs. Salt - ness-tech.co.ilירועים 2015/DevOps... · •Automation and orchestration ... Puppet in a Nutshell

Thank you!

vs.