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

Test driven infrastructure with chef

Test driven infrastructure with chef

The slides to my talk at the DevOps Würzburg Meetup on 2017-09-12.

Git repository with DEMO code: https://gitlab.com/muhh/devops_wue_tdi

Markus Heurung

September 12, 2017
Tweet

More Decks by Markus Heurung

Other Decks in Technology

Transcript

  1. $ whoami MARKUS HEURUNG > @muhh > [email protected] > Web

    Ops lead @freistil building freistilbox
  2. CHEFDK The Chef Development Kit is a package that contains

    everything that is needed to start using Chef1 1 https://docs.chef.io/workstation.html#chef-dk
  3. CHEFDK > chef generate > rubocop > foodcritic > Berkshelf

    > serverspec > inspec > test-kitchen
  4. RUBOCOP RuboCop is a Ruby static code analyzer. Out of

    the box it will enforce many of the guidelines outlined in the community Ruby Style Guide.2 chef exec rubocop . 2 http://rubocop.readthedocs.io/
  5. FOODCRITIC Foodcritic is a helpful lint tool you can use

    to check your Chef cookbooks for common problems.3 chef exec foodcritic . 3 http://foodcritic.io
  6. BERKSHELF Berkshelf is a dependency manager for Chef cookbooks. With

    it, you can easily depend on community cookbooks and have them safely included in your workflow.4 4 http://berkshelf.com
  7. CHEFSPEC ChefSpec is a unit testing framework for testing Chef

    cookbooks. ChefSpec makes it easy to write examples and get fast feedback on cookbook changes without the need for virtual machines or cloud servers.5 5 https://chefspec.github.io/chefspec/
  8. SERVERSPEC RSpec tests for your servers configured by CFEngine, Puppet,

    Ansible, Itamae or anything else.6 6 http://serverspec.org
  9. TEST-KITCHEN Kitchen provides a test harness to execute infrastructure code

    on one or more platforms in isolation.8 8 http://kitchen.ci
  10. .KITCHEN.YML --- driver: name: vagrant require_chef_omnibus: true provisioner: name: chef_zero

    verifier: name: inspec platforms: - name: ubuntu-16.04 - name: windows-2012r2 suites: - name: client run_list: - recipe[postgresql::client] - name: server run_list: - recipe[postgresql::server]