Test Kitchen and Infrastructure as Code

46
Test Kitchen and Infrastructure as Code Cyber Summit 2014 September 25, 2014 Fletcher Nichol @fnichol

description

A presentation for the Automation session at the 2014 Cyber Summit by Fletcher Nichol, an Engineer with Heavy Water Operations.

Transcript of Test Kitchen and Infrastructure as Code

Page 1: Test Kitchen and Infrastructure as Code

Test Kitchen and

Infrastructure as CodeCyber Summit 2014 September 25, 2014

Fletcher Nichol @fnichol

Page 2: Test Kitchen and Infrastructure as Code

http://hw-ops.com

Page 3: Test Kitchen and Infrastructure as Code

1. Infrastructure as Code 2. Test Kitchen

Agenda

Page 4: Test Kitchen and Infrastructure as Code

I am a software developer

Preface

Page 5: Test Kitchen and Infrastructure as Code

What isInfrastructure?

Page 6: Test Kitchen and Infrastructure as Code

Physical and virtual resources: compute (servers, vms), networking, storage, etc.

Infrastructure

Page 7: Test Kitchen and Infrastructure as Code

What isInfrastructure Automation?

Page 8: Test Kitchen and Infrastructure as Code

Code

Page 9: Test Kitchen and Infrastructure as Code

Software

Page 10: Test Kitchen and Infrastructure as Code

What isInfrastructure

As Code?

Page 11: Test Kitchen and Infrastructure as Code

“Enable the reconstruction of the business from nothing but a source code repository, an application data backup, and bare metal resources”

Infrastructure as Code

- Adam Jacob, Web Operations

Page 12: Test Kitchen and Infrastructure as Code
Page 13: Test Kitchen and Infrastructure as Code
Page 14: Test Kitchen and Infrastructure as Code

If we can model infrastructure as code

Page 15: Test Kitchen and Infrastructure as Code

If we can model infrastructure as code

can we apply code process and practices?

Page 16: Test Kitchen and Infrastructure as Code

In other words…

Page 17: Test Kitchen and Infrastructure as Code

Can we apply

Page 18: Test Kitchen and Infrastructure as Code

Can we applySoftware Engineering

to infrastrcuture?

Page 19: Test Kitchen and Infrastructure as Code

Yep.

Page 20: Test Kitchen and Infrastructure as Code

What processes and practices apply to software?

Page 21: Test Kitchen and Infrastructure as Code

Testing

Page 22: Test Kitchen and Infrastructure as Code

Test Kitchen“Your infrastructure deserves tests too”

Page 23: Test Kitchen and Infrastructure as Code
Page 24: Test Kitchen and Infrastructure as Code

An infrastructure testing tool

Test Kitchen

Page 25: Test Kitchen and Infrastructure as Code

Used in development

Test Kitchen

Page 26: Test Kitchen and Infrastructure as Code

Used in CI/CD pipeline

Test Kitchen

Page 27: Test Kitchen and Infrastructure as Code

Describes your testing setup on a single server

Test Kitchen

Page 28: Test Kitchen and Infrastructure as Code

.kitchen.yml

Test Kitchen Code

Page 29: Test Kitchen and Infrastructure as Code

--- driver: name: vagrant !

provisioner: name: chef_solo !

platforms: - name: ubuntu-14.04 - name: centos-6.5 !

suites: - name: client run_list: - recipe[postgresql::client] - name: server run_list: - recipe[postgresql::server]

Code

Page 30: Test Kitchen and Infrastructure as Code

--- driver: name: vagrant !

provisioner: name: chef_solo !

platforms: - name: ubuntu-14.04 - name: centos-6.5 !

suites: - name: client run_list: - recipe[postgresql::client] - name: server run_list: - recipe[postgresql::server]

Code

Page 31: Test Kitchen and Infrastructure as Code

--- driver: name: vagrant !

provisioner: name: chef_solo !

platforms: - name: ubuntu-14.04 - name: centos-6.5 !

suites: - name: client run_list: - recipe[postgresql::client] - name: server run_list: - recipe[postgresql::server]

Code

Page 32: Test Kitchen and Infrastructure as Code

--- driver: name: vagrant !

provisioner: name: chef_solo !

platforms: - name: ubuntu-14.04 - name: centos-6.5 !

suites: - name: client run_list: - recipe[postgresql::client] - name: server run_list: - recipe[postgresql::server]

Code

Page 33: Test Kitchen and Infrastructure as Code

--- driver: name: vagrant !

provisioner: name: chef_solo !

platforms: - name: ubuntu-14.04 - name: centos-6.5 !

suites: - name: client run_list: - recipe[postgresql::client] - name: server run_list: - recipe[postgresql::server]

Code

Page 34: Test Kitchen and Infrastructure as Code

Runs multiple testing setups in isolation

Test Kitchen

Page 35: Test Kitchen and Infrastructure as Code

Plugin system to support automation tools, cloud providers,

& testing frameworks

Test Kitchen

Page 36: Test Kitchen and Infrastructure as Code

Amazon EC2, Rackspace, Digital Ocean, OpenStack, LXC, Vagrant, CloudStack,

Joyent, VMware vSphere, Google Compute Engine, Microsoft Azure, Docker, etc.

Test KitchenDrivers

Page 37: Test Kitchen and Infrastructure as Code

Chef (Solo, Client), Simple Shell, Puppet (Apply), Salt, Ansible, etc.

Test KitchenProvisioners

Page 38: Test Kitchen and Infrastructure as Code

Simple bash, bats, MiniTest, shUnit2, Aruba, Serverspec,

RSpec, shpec, Cucumber, etc.

Test KitchenTesting Frameworks

Page 39: Test Kitchen and Infrastructure as Code

http://kitchen.ci/docs/getting-started/

Test KitchenGetting Started

Page 40: Test Kitchen and Infrastructure as Code

“In short, software is eating the world.”

It’s All Software

- Marc Andreessen, 2011

Page 41: Test Kitchen and Infrastructure as Code

Infrastructure Automation is

Real

Page 42: Test Kitchen and Infrastructure as Code

Infrastructure Automation is

Real Hard™

Page 43: Test Kitchen and Infrastructure as Code

Infrastructure Automation is

Real …but

Page 44: Test Kitchen and Infrastructure as Code

Infrastructure Automation is

Real Possible™

Page 45: Test Kitchen and Infrastructure as Code

Thanks!Cyber Summit 2014 September 25, 2014

Fletcher Nichol @fnichol

Page 46: Test Kitchen and Infrastructure as Code

Photo Creditshttps://flic.kr/p/fD2CXV https://flic.kr/p/i3NECz https://flic.kr/p/9urXjF