Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Test Driven Infrastructure

Test Driven Infrastructure

An intro to Test Driven Infrastructure, using ServerSpec

Gabriel Fortuna

April 28, 2015
Tweet

More Decks by Gabriel Fortuna

Other Decks in Programming

Transcript

  1. Test Driven Infrastructure
    Gabriel Fortuna // Zero One
    JOZI.RB

    View Slide

  2. TOPIC
    DevOps trends
    What is Test Driven Infrastructure?
    CMDB’s
    Your workflow and environment
    Uses
    Demo
    DevOps Trends
    The lay of the land
    Where DevOps was, is
    and will be.
    TDI?
    What’s it about?
    Automation safety
    nets.
    Role of CMDB’s
    ISO20k/ITIL
    What is
    vs.
    What should be
    Workflow
    Delivery
    Opportunities
    for integration
    into delivery pipeline
    Uses
    More than testing
    Obvious cases
    Right cases
    Wrong cases
    Demo
    TDI in action
    A small canned demo
    illustrating the tip
    of the iceberg
    Agenda
    What You Can Expect From This Talk

    View Slide

  3. DevOps Trends

    View Slide

  4. DevOps Trends
    The Lay Of The Land

    View Slide

  5. DevOps Trends
    The Lay Of The Land

    View Slide

  6. DevOps Trends
    The Lay Of The Land

    View Slide

  7. Trends Continued
    So Many Variables
    Container wars
    Docker? Not so fast.
    What about rkt?
    Canonical LXD?
    MS Drawbridge?
    1
    Good ol’ shell scripts
    Ansible?
    Chef?
    Puppet?
    Salt?
    CFEngine?
    Orchestration
    tools
    2
    Heroku?
    AWS?
    Google?

    EngineYard?
    CloudAfrica?
    The Cloud
    3

    View Slide

  8. Trends Continued
    So Many Variables
    Ansible?
    Chef?
    Puppet?
    Salt?
    CFEngine?
    Orchestration
    tools
    2
    Heroku?
    AWS?
    Google?

    EngineYard?
    CloudAfrica?
    The cloud
    3
    No longer about
    simply on-demand
    deploy. That doesn’t
    scale.
    Mass system (not
    server) deploy on
    test pass
    Continuous
    Delivery
    4

    View Slide

  9. Trends Continued
    So Many Variables
    Heroku?
    AWS?
    Google?

    EngineYard?
    CloudAfrica?
    The cloud
    3
    No longer about
    simply on-demand
    deploy. That doesn’t
    scale.
    Mass system (not
    server) deploy on
    test pass
    Continuous
    Delivery
    4
    Enterprise lagging
    behind. Is this a
    threat, or an
    opportunity?
    Still figuring this
    Devops thing out
    5

    View Slide

  10. What Is Test Driven
    Infrastructure?

    View Slide

  11. What Is Test Driven Infrastructure
    Introducing Serverspec - What It Is

    View Slide

  12. What Is Test Driven Infrastructure
    Introducing Serverspec - What It Is
    Agnostic Open Source
    Based on
    RSpec

    View Slide

  13. What Is Test Driven Infrastructure
    Introducing Serverspec - What It Is
    Agnostic Open Source
    Based on
    RSpec
    Win or Linux
    Version 2 just
    released

    View Slide

  14. What Is Test Driven Infrastructure
    Introducing Serverspec - What It Is
    Agnostic Open Source
    Based on
    RSpec
    Win or Linux
    Version 2 just
    released
    SOME HIGHLIGHTS ON SERVERSPEC
    Serverspec tests your servers'
    actual state by executing
    commands locally, via SSH, WinRM,
    Docker API,
    The true aim of Serverspec is to
    help refactor infrastructure code.

    View Slide

  15. Serverspec Feature Showcase
    Super fast to setup.
    First tests can be ready in less
    than 5 minutes.
    BOOTSTRAPPED SETUP
    Hardware, Software, Packages,
    Containers, and lots more
    TONS OF RESOURCE TYPES

    View Slide

  16. Serverspec Feature Showcase
    Add to your existing Ruby Gemfile.
    Or, add to any other project.
    Or, create a dedicated project (Ops)
    RUNS WHEREVER RUBY DOES
    Gather facts about the system
    and verify their state.
    HOST INVENTORY

    View Slide

  17. Serverspec Feature Showcase
    Easy to read, browse and
    discover.
    Docs also available in Dash.
    SUPER GREAT DOCS
    Github search: serverspec &
    specinfra
    TONS OF PLUGINS

    View Slide

  18. The Role Of A CMDB
    in DevOps and TDI

    View Slide

  19. CMDB’S
    The ‘Well-Actually’s Of Enterprise
    10%
    EXCEPTION REPORTING
    GOVERNANCE
    RISK MANAGEMENT
    PRINCIPLES
    What we think vs. What there actually is
    Change Control
    What doesn’t match with reality anymore?
    What’s out there that we aren’t aware of?
    Anything vulnerable out there?
    Anything we can’t support out there?

    View Slide

  20. CMDB’S
    The ‘Well-Actually’s Of Enterprise
    25%
    EXCEPTION REPORTING
    GOVERNANCE
    RISK MANAGEMENT
    PRINCIPLES
    What we think vs. What there actually is
    Change Control
    What doesn’t match with reality anymore?
    What’s out there that we aren’t aware of?
    Anything vulnerable out there?
    Anything we can’t support out there?

    View Slide

  21. CMDB’S
    The ‘Well-Actually’s Of Enterprise
    50%
    EXCEPTION REPORTING
    GOVERNANCE
    RISK MANAGEMENT
    PRINCIPLES
    What we think vs. What there actually is
    Change Control
    What doesn’t match with reality anymore?
    What’s out there that we aren’t aware of?
    Anything vulnerable out there?
    Anything we can’t support out there?

    View Slide

  22. CMDB’S
    The ‘Well-Actually’s Of Enterprise
    75%
    EXCEPTION REPORTING
    GOVERNANCE
    RISK MANAGEMENT
    PRINCIPLES
    What we think vs. What there actually is
    Change Control
    What doesn’t match with reality anymore?
    What’s out there that we aren’t aware of?
    Anything vulnerable out there?
    Anything we can’t support out there?

    View Slide

  23. CMDB’S
    The ‘Well-Actually’s Of Enterprise
    100%
    EXCEPTION REPORTING
    GOVERNANCE
    RISK MANAGEMENT
    PRINCIPLES
    What we think vs. What there actually is
    Change Control
    What doesn’t match with reality anymore?
    What’s out there that we aren’t aware of?
    Anything vulnerable out there?
    Anything we can’t support out there?

    View Slide

  24. Workflow And Environment

    View Slide

  25. Workflow And Environment
    Vision Of A Typical Workflow For TDI
    Time to figure out
    what your client wants
    1. NEW WORK!
    Bootstrap your
    app environment.
    2. GET STARTED
    What will this
    run on, and
    how?
    3. ARCHITECTURE
    New
    requirements
    6. CHANGES!
    Test all environments
    if possible.
    5. INTEGRATE TO CI
    Reflect the new
    reality
    7. REFACTOR!
    Get your infra
    back to green.
    8. RETEST
    Steps 2 - 8
    9. REPEAT
    Write tests that reflect
    your target arch.
    4. GET TESTING!

    View Slide

  26. Uses For Test Driven
    Infrastructure

    View Slide

  27. Uses For TDI
    A Glide Path For Adoption, With Pitfall Warnings
    Right *
    Some clear examples
    where TDI adds real
    value.
    Wrong *
    Maybe not wrong, but
    possibly better
    achieved with other
    tools.
    Obvious *
    Start with these use
    cases to show
    immediate value.

    View Slide

  28. Uses For TDI
    A Glide Path For Adoption, With Pitfall Warnings
    Obvious *
    Start with these use
    cases to show
    immediate value.
    As ServerSpec is a relatively new thing, get out
    the gates with things that yield clear value
    quickly. This will help with buy-in down the
    road.
    QUICK, SIMPLE, CLEAR WINS
    Reports
    CI
    Release pipeline
    Early tests
    Set standards
    Manual stuff

    View Slide

  29. Obvious *
    Start with these use
    cases to show
    Uses For TDI
    A Glide Path For Adoption, With Pitfall Warnings
    TDI with ServerSpec can unlock massive
    value, and drastically reduce the ‘surprise’
    factor of DevOps. Here are some clever wins
    that are available out-of-the-box once
    you’re more comfortable with it.
    SERVERSPEC BONANZA
    Security - HW
    Git Single Suite
    Change Mgmt
    Base Suite
    Version Pkgs
    Processes
    Right *
    Some clear examples
    where TDI adds real
    value.

    View Slide

  30. Uses For TDI
    A Glide Path For Adoption, With Pitfall Warnings
    Nina Smith
    Illustrator
    Life is short. Play with
    your dog.
    The power of ServerSpec means you could
    use it to solve the right problem the wrong
    way. Also, testing well is hard.
    HERE BE DRAGONS
    Right *
    Some clear examples
    where TDI adds real
    value.
    Wrong *
    Maybe not wrong, but
    possibly better
    achieved with other
    tools.
    Command abuse
    Net Ports
    Wrong order
    Static tests

    View Slide

  31. ServerSpec Demo

    View Slide

  32. Thanks For Watching
    @we_are_zero_one
    [email protected]
    http://zero-one.io

    View Slide