Chef and Azure -
Powering High Velocity Development for
your Infrastructure and Applications
James Casey, VP of Partner Engineering | james@chef.io
Who we are
• Based in Seattle with offices in London, San Francisco and Atlanta
• Leader in automation for DevOps
• Partnerships with Microsoft, AWS, HP, VMware, IBM, Accenture, PWC, Infosys, etc…
• Venture backed by DFJ, Ignition, Battery Ventures, Citi Ventures, Scale, Amplify, etc…
• 20 million open source downloads, 750+ customers
Chef: Leader in the DevOps Market
Born with the
DevOps
movement
Provider to web
leaders and the
enterprise
Understands
DevOps
success
patterns
Distilled these
patterns into
the Chef
platform
What is Chef?
“Together, Chef and Microsoft are empowering
DevOps adoption in the enterprise with integrated
technologies that improve collaboration and speed
software development.”
- Jeffrey Snover, Technical Fellow and Lead Architect for Windows Server, Microsoft
Go Fast Safely: Allow Teams to Build Code and Automate Systems
• Infrastructure as
Code
• Containers as Code
• Policy as Code
• Process as Code
• Applications
Reinforce the right
behaviors to
collaborate safely on
code at velocity
Culture
Automation
Cloud
Build, deploy, and
manage
infrastructure and
applications
anywhere
Migrate applications to
the cloud and support
hybrid and multi-cloud
environments
version
collaborate
consistently
test
automatically
Deploy Anywhere
● On-premise
● Cloud
● Hybrid-Cloud
Configuration
Automation
Workflow
ApplicationInfrastructure
Cloud – the path to dynamic infrastructure
Migrate applications to the cloud and support hybrid and multi-
cloud environments. Automate the management of
heterogeneous networks, including legacy systems.
• Provisioning and setting up environments
• Dynamic scaling of compute resources
• Migrating legacy workloads to the cloud
• Multi cloud and hybrid cloud deployment
• Support for heterogeneous environments
Automation – turn infrastructure into
code
Turn infrastructure into code—infrastructure as code is
versionable, testable and repeatable. Manual processes become a
thing of the past.
• Automated, full-stack application policies
• Package and service installation
• Versionable, testable, repeatable workflow
• Scalable application policies
• Management of interdependencies across nodes
Culture – collaborate safely at velocity
Eliminate silos and lower the overhead of IT operations and
service management by supporting DevOps culture. Build
communities.
• Unified workflow for application and infrastructure
• Integration with version control for development
and operations
• Support for automated testing of infrastructure and
applications
• Integration of security and compliance into product
development
• Advanced, high-velocity workflow
The rewards?*
*source: Dr. Nicole Forsgren research on DevOps
More deployments
Ship faster
Faster MTR after issues
More profits, market share, and productivity
Market cap goes up
Chef provides a proven approach to DevOps
...
...
...
Targets/Workloads
Collaborative Development
Chef Analytics
Production
Chef Server
Chef Server
Chef
Supermarket
Assessment
Chef Compliance
Search
Audit
Discover
Deploy
Chef Delivery
Local Development
Model
Build
Test
Chef Development Kit
Chef Client & Cookbooks
Chef Integrations to the Microsoft Ecosystem
Hybrid
management
across clouds
Chef and
Windows
Server
Chef development
tools for Windows
Chef and Azure
Tap into cloud services quickly and easily
• Native Chef integration in Azure portal
• Azure SDK Tools PowerShell cmdlets
• Knife Azure plugin lets you:
• Create VM instances managed by Chef
Server
• Deploy applications through the Azure API
• Enumerate instances and images
• Delete instances from Azure and Chef
• Chef Server and Chef Compliance in Azure
Marketplace
• Allows easy, dynamic consumption of Chef
Traditional Data
Center
Modern data center
• Upgrade to Windows 2012
• Virtualize with Hyper-V
• PowerShell DSC deployment
• Automate and control all
Windows and Linux servers with
Chef
Migrate workloads to Azure
• Automate and control
Windows and Linux in Azure
cloud instances with Chef
Migrate and automate workloads with Chef
Full support for Windows and Linux environments
Knife Windows
plugin supports:
Bootstrapping
Windows servers and
remote command
execution using winrm
or ssh
Chef Development
Kit available for
Windows
Full Chef developer
experience available
on Windows
Test kitchen driver
support for Windows
Guests and
AzureRM
Run your Chef code
against Windows/Linux
machines in Azure
Success Example: Target
https://www.youtube.com/watch?v=UxmGSi3LYoY
Success Example: Intuit
https://www.youtube.com/watch?v=YA3VXAQqDi4
Success Example: Application Deployment
Success Example: Top Five Global Bank
The Chef Platform
Chef Analytics Chef Delivery
Management
console
High availability
and replication
Chef Provisioning
Chef
Development Kit
Cookbook and
policy authoring
Test-driven
infrastructure
Containers
Cloud
VMs
Devices
Chef ServerChef Solo
Ecosystem
(content,plugins,etc.)
Search & Discovery
Chef Success Engineering
Chef Server
Policy
State
State queries
Servers, VMs, cloud instances, etc.
running the Chef client
• The Chef server stores policy and configuration data
• The Chef client periodically runs on each node in the network
• Chef clients poll the server for the latest policies
• Chef clients notify the server of their states and can query for the states
of other nodes
Cookbooks
Recipes
Resources
The building blocks of Chef policy
Resources
A Resource is a system state you define
Example: Package installed, state of a service, configuration file existing
You declare what state you want the resource in.
Chef automatically determines HOW that state is achieved
On Linux based OSes: On Windows based
OSes:
Recipes
An abstraction of a Service that consists of a set of Resources to deliver that
Service
Resources are executed in the order they are listed
On Linux based OSes: On Windows based
OSes:
Cookbooks
A Higher Level Abstraction of a Service
A set of Recipes and Data Attributes
required to deliver one or multiple
Services
Test Driven Development Revolutionized Releasing
Software
TDD
Red
Refacto
r
Green
1. Write a test
that fails
2. Make the
code work
3. Eliminate
redundancy
 Simple, understandable
code
 Provable quality
 Respond quickly and
cheaply
</>
Test Driven Development
Infrastructure Needs Testing, Too!
infrastructure
as code< />
DocumentationVersioning Test before
you deploy
= QUALITY AND VELOCITY
Old Infrastructure Automation Workflow
</>
New Infrastructure Automation Workflow
</>
Test Driven Infrastructure Enables Faster Teams
 Enables small (documented) changes
 Infrastructure has provable quality bar
 Infrastructure moves as fast as applications
+ TDI lets developers replicate production
environments with confidence
“Any gap between what is on a programmer’s desk and production is a risk”
– Kent Beck
ChefDK: TDI In a Box
Code Correctness
Unit Tests
Deploy sample environments
A wrapper to tie it all together
Rubocop
Code Correctness
A Ruby static
code analyzer
Checks for rules
based on the
community Ruby style
guide
Rules can be
customized to
your
environment
Rubocop Example
def badName
if something
test
end
end
test.rb:1:5: C: Use snake_case for methods and variables.
def badName
^^^^^^^
test.rb:2:3: C: Favor modifier if/unless usage when you
have a single-line body. Another good alternative is the
usage of control flow &&/||.
if something
^^
test.rb:4:5: W: end at 4, 4 is not aligned with if at 2, 2
end
^^^
1 file inspected, 3 offenses detected
Code Correctness
FoodCritic
Code Correctness
A static code
analyzer
Checks for
Chef cookbook
style guidelines
Rules can be
customized to
your
environment
FoodCritic Examples
• FC001: Use strings in preference to symbols to access node attributes
• FC002: Avoid string interpolation where not required
• FC003: Check whether you are running with chef server before using server -
specific features
• FC004: Use a service resource to start and stop services
• FC005: Avoid repetition of resource declarations
• FC006: Mode should be quoted or fully specified when setting file
permissions
• FC007: Ensure recipe dependencies are reflected in cookbook metadata
Code Correctness
ChefSpec
Unit Tests
A unit testing
framework for
testing Chef
cookbooks
Syntax and
concepts
similar to unit
tests written in
RSpec
Runs locally –
no need for
VMs or remote
servers
Makes it easy
to write
examples and
get fast
feedback
ChefSpec Example
require 'chefspec'
describe 'example::default' do
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
it 'installs foo' do
expect(chef_run).to install_package('foo')
end
end
Unit Tests
Test Kitchen
Deploy sample environments
Tests Chef
cookbooks using
cloud instances
and virtual
machines
Lets you create a
realistic multi-
server test
environment
Uses Chef and
supports everything
Chef supports (OSs,
VMs, Languages,
etc)
Supports multiple
test runners
(Bats, Minitest,
Rspec,
ServerSpec,
InSpec, etc.)
Test Kitchen
it 'contains the default configuration settings' do
file(File.join(node['chef_client']['conf_dir'], 'client.rb')).must_match('^chef_server_url')
file(File.join(node['chef_client']['conf_dir'], 'client.rb')).must_match('^validation_client_name')
end
it 'converts ssl_verify_mode to a symbol' do
file(File.join(node['chef_client']['conf_dir'], 'client.rb')).must_match('^ssl_verify_mode
:verify_peer')
end
it 'disables ohai plugins' do
regexp = 'Ohai::Config¥[:disabled_plugins¥] =¥s+¥["passwd"¥]'
file(File.join(node['chef_client']['conf_dir'], 'client.rb')).must_match(/#{regexp}/)
end
Deploy sample environments
Demo: TDI with Test Kitchen and InSpec using Azure
1. Scan a host using Chef Compliance
2. Be alerted of a security issue
3. Use Test Kitchen to reproduce the
problem on a development instance in
Azure
4. Remediate the issue
5. Update Chef Server with our fix
6. Re-scan to show the security problem is
fixed
Go Fast Safely: Allow Teams to Build Code and Automate Systems
• Infrastructure as
Code
• Containers as Code
• Policy as Code
• Process as Code
• Applications
Reinforce the right
behaviors to
collaborate safely on
code at velocity
Culture
Automation
Cloud
Build, deploy, and
manage
infrastructure and
applications
anywhere
Migrate applications to
the cloud and support
hybrid and multi-cloud
environments
version
collaborate
consistently
test
automatically
Deploy Anywhere
● On-premise
● Cloud
● Hybrid-Cloud
Configuration
Automation
Workflow
ApplicationInfrastructure
chef.io
learn.chef.io
docs.chef.io
Email info@chef.io
Twitter @Chef
Download Chef downloads.chef.io
Chef Training chef.io/training
YouTube youtube.com/getchef
Community Site supermarket.chef.io
Freenode IRC #chef, #chef-hacking,
#openstack-chef
We are Chef.
We are IT automation for speed and
awesomeness. We are open source. We give
you a model for automating IT infrastructure
and applications that drive self-reliance
across your development and operations
teams. We are the Chef community. We are
tens of thousands strong. We are helping
your businesses become faster, safer and
more flexible, so you win in today’s 24x7
digital economy. Join our movement today.
DOO-009_Powering High Velocity Development for your Infrastructure

DOO-009_Powering High Velocity Development for your Infrastructure

  • 1.
    Chef and Azure- Powering High Velocity Development for your Infrastructure and Applications James Casey, VP of Partner Engineering | james@chef.io
  • 2.
    Who we are •Based in Seattle with offices in London, San Francisco and Atlanta • Leader in automation for DevOps • Partnerships with Microsoft, AWS, HP, VMware, IBM, Accenture, PWC, Infosys, etc… • Venture backed by DFJ, Ignition, Battery Ventures, Citi Ventures, Scale, Amplify, etc… • 20 million open source downloads, 750+ customers
  • 3.
    Chef: Leader inthe DevOps Market Born with the DevOps movement Provider to web leaders and the enterprise Understands DevOps success patterns Distilled these patterns into the Chef platform
  • 4.
  • 5.
    “Together, Chef andMicrosoft are empowering DevOps adoption in the enterprise with integrated technologies that improve collaboration and speed software development.” - Jeffrey Snover, Technical Fellow and Lead Architect for Windows Server, Microsoft
  • 6.
    Go Fast Safely:Allow Teams to Build Code and Automate Systems • Infrastructure as Code • Containers as Code • Policy as Code • Process as Code • Applications Reinforce the right behaviors to collaborate safely on code at velocity Culture Automation Cloud Build, deploy, and manage infrastructure and applications anywhere Migrate applications to the cloud and support hybrid and multi-cloud environments version collaborate consistently test automatically Deploy Anywhere ● On-premise ● Cloud ● Hybrid-Cloud Configuration Automation Workflow ApplicationInfrastructure
  • 7.
    Cloud – thepath to dynamic infrastructure Migrate applications to the cloud and support hybrid and multi- cloud environments. Automate the management of heterogeneous networks, including legacy systems. • Provisioning and setting up environments • Dynamic scaling of compute resources • Migrating legacy workloads to the cloud • Multi cloud and hybrid cloud deployment • Support for heterogeneous environments
  • 8.
    Automation – turninfrastructure into code Turn infrastructure into code—infrastructure as code is versionable, testable and repeatable. Manual processes become a thing of the past. • Automated, full-stack application policies • Package and service installation • Versionable, testable, repeatable workflow • Scalable application policies • Management of interdependencies across nodes
  • 9.
    Culture – collaboratesafely at velocity Eliminate silos and lower the overhead of IT operations and service management by supporting DevOps culture. Build communities. • Unified workflow for application and infrastructure • Integration with version control for development and operations • Support for automated testing of infrastructure and applications • Integration of security and compliance into product development • Advanced, high-velocity workflow
  • 10.
    The rewards?* *source: Dr.Nicole Forsgren research on DevOps More deployments Ship faster Faster MTR after issues More profits, market share, and productivity Market cap goes up
  • 11.
    Chef provides aproven approach to DevOps ... ... ... Targets/Workloads Collaborative Development Chef Analytics Production Chef Server Chef Server Chef Supermarket Assessment Chef Compliance Search Audit Discover Deploy Chef Delivery Local Development Model Build Test Chef Development Kit Chef Client & Cookbooks
  • 12.
    Chef Integrations tothe Microsoft Ecosystem Hybrid management across clouds Chef and Windows Server Chef development tools for Windows Chef and Azure
  • 13.
    Tap into cloudservices quickly and easily • Native Chef integration in Azure portal • Azure SDK Tools PowerShell cmdlets • Knife Azure plugin lets you: • Create VM instances managed by Chef Server • Deploy applications through the Azure API • Enumerate instances and images • Delete instances from Azure and Chef • Chef Server and Chef Compliance in Azure Marketplace • Allows easy, dynamic consumption of Chef
  • 14.
    Traditional Data Center Modern datacenter • Upgrade to Windows 2012 • Virtualize with Hyper-V • PowerShell DSC deployment • Automate and control all Windows and Linux servers with Chef Migrate workloads to Azure • Automate and control Windows and Linux in Azure cloud instances with Chef Migrate and automate workloads with Chef
  • 15.
    Full support forWindows and Linux environments Knife Windows plugin supports: Bootstrapping Windows servers and remote command execution using winrm or ssh Chef Development Kit available for Windows Full Chef developer experience available on Windows Test kitchen driver support for Windows Guests and AzureRM Run your Chef code against Windows/Linux machines in Azure
  • 16.
  • 17.
  • 18.
  • 19.
    Success Example: TopFive Global Bank
  • 20.
    The Chef Platform ChefAnalytics Chef Delivery Management console High availability and replication Chef Provisioning Chef Development Kit Cookbook and policy authoring Test-driven infrastructure Containers Cloud VMs Devices Chef ServerChef Solo Ecosystem (content,plugins,etc.) Search & Discovery Chef Success Engineering
  • 21.
    Chef Server Policy State State queries Servers,VMs, cloud instances, etc. running the Chef client • The Chef server stores policy and configuration data • The Chef client periodically runs on each node in the network • Chef clients poll the server for the latest policies • Chef clients notify the server of their states and can query for the states of other nodes
  • 22.
  • 23.
    Resources A Resource isa system state you define Example: Package installed, state of a service, configuration file existing You declare what state you want the resource in. Chef automatically determines HOW that state is achieved On Linux based OSes: On Windows based OSes:
  • 24.
    Recipes An abstraction ofa Service that consists of a set of Resources to deliver that Service Resources are executed in the order they are listed On Linux based OSes: On Windows based OSes:
  • 25.
    Cookbooks A Higher LevelAbstraction of a Service A set of Recipes and Data Attributes required to deliver one or multiple Services
  • 26.
    Test Driven DevelopmentRevolutionized Releasing Software TDD Red Refacto r Green 1. Write a test that fails 2. Make the code work 3. Eliminate redundancy  Simple, understandable code  Provable quality  Respond quickly and cheaply
  • 27.
  • 28.
    Infrastructure Needs Testing,Too! infrastructure as code< /> DocumentationVersioning Test before you deploy = QUALITY AND VELOCITY
  • 29.
  • 30.
  • 31.
    Test Driven InfrastructureEnables Faster Teams  Enables small (documented) changes  Infrastructure has provable quality bar  Infrastructure moves as fast as applications + TDI lets developers replicate production environments with confidence “Any gap between what is on a programmer’s desk and production is a risk” – Kent Beck
  • 32.
    ChefDK: TDI Ina Box Code Correctness Unit Tests Deploy sample environments A wrapper to tie it all together
  • 33.
    Rubocop Code Correctness A Rubystatic code analyzer Checks for rules based on the community Ruby style guide Rules can be customized to your environment
  • 34.
    Rubocop Example def badName ifsomething test end end test.rb:1:5: C: Use snake_case for methods and variables. def badName ^^^^^^^ test.rb:2:3: C: Favor modifier if/unless usage when you have a single-line body. Another good alternative is the usage of control flow &&/||. if something ^^ test.rb:4:5: W: end at 4, 4 is not aligned with if at 2, 2 end ^^^ 1 file inspected, 3 offenses detected Code Correctness
  • 35.
    FoodCritic Code Correctness A staticcode analyzer Checks for Chef cookbook style guidelines Rules can be customized to your environment
  • 36.
    FoodCritic Examples • FC001:Use strings in preference to symbols to access node attributes • FC002: Avoid string interpolation where not required • FC003: Check whether you are running with chef server before using server - specific features • FC004: Use a service resource to start and stop services • FC005: Avoid repetition of resource declarations • FC006: Mode should be quoted or fully specified when setting file permissions • FC007: Ensure recipe dependencies are reflected in cookbook metadata Code Correctness
  • 37.
    ChefSpec Unit Tests A unittesting framework for testing Chef cookbooks Syntax and concepts similar to unit tests written in RSpec Runs locally – no need for VMs or remote servers Makes it easy to write examples and get fast feedback
  • 38.
    ChefSpec Example require 'chefspec' describe'example::default' do let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) } it 'installs foo' do expect(chef_run).to install_package('foo') end end Unit Tests
  • 39.
    Test Kitchen Deploy sampleenvironments Tests Chef cookbooks using cloud instances and virtual machines Lets you create a realistic multi- server test environment Uses Chef and supports everything Chef supports (OSs, VMs, Languages, etc) Supports multiple test runners (Bats, Minitest, Rspec, ServerSpec, InSpec, etc.)
  • 40.
    Test Kitchen it 'containsthe default configuration settings' do file(File.join(node['chef_client']['conf_dir'], 'client.rb')).must_match('^chef_server_url') file(File.join(node['chef_client']['conf_dir'], 'client.rb')).must_match('^validation_client_name') end it 'converts ssl_verify_mode to a symbol' do file(File.join(node['chef_client']['conf_dir'], 'client.rb')).must_match('^ssl_verify_mode :verify_peer') end it 'disables ohai plugins' do regexp = 'Ohai::Config¥[:disabled_plugins¥] =¥s+¥["passwd"¥]' file(File.join(node['chef_client']['conf_dir'], 'client.rb')).must_match(/#{regexp}/) end Deploy sample environments
  • 41.
    Demo: TDI withTest Kitchen and InSpec using Azure 1. Scan a host using Chef Compliance 2. Be alerted of a security issue 3. Use Test Kitchen to reproduce the problem on a development instance in Azure 4. Remediate the issue 5. Update Chef Server with our fix 6. Re-scan to show the security problem is fixed
  • 42.
    Go Fast Safely:Allow Teams to Build Code and Automate Systems • Infrastructure as Code • Containers as Code • Policy as Code • Process as Code • Applications Reinforce the right behaviors to collaborate safely on code at velocity Culture Automation Cloud Build, deploy, and manage infrastructure and applications anywhere Migrate applications to the cloud and support hybrid and multi-cloud environments version collaborate consistently test automatically Deploy Anywhere ● On-premise ● Cloud ● Hybrid-Cloud Configuration Automation Workflow ApplicationInfrastructure
  • 43.
    chef.io learn.chef.io docs.chef.io Email info@chef.io Twitter @Chef DownloadChef downloads.chef.io Chef Training chef.io/training YouTube youtube.com/getchef Community Site supermarket.chef.io Freenode IRC #chef, #chef-hacking, #openstack-chef We are Chef. We are IT automation for speed and awesomeness. We are open source. We give you a model for automating IT infrastructure and applications that drive self-reliance across your development and operations teams. We are the Chef community. We are tens of thousands strong. We are helping your businesses become faster, safer and more flexible, so you win in today’s 24x7 digital economy. Join our movement today.