SlideShare a Scribd company logo
DevOps
Orchestration with Chef
Presented By:
Mayank Gaikwad
04/06/16 Mayank Gaikwad
Agenda
04/06/16 Mayank Gaikwad
• Chef Provisioner
• Secret Management
• Cookbook Versioning
• Dependency Management
• Test Driven Infrastructure
Chef Provisioning
“ Allows to manage infrastructure with repeatable resource
creation/deletion on different environment from dev, QA to production
in very abstract and easy way”
This is next step forward , Chef as configuration management tool
What can be achieved-
Idempotency
Cluster Management
Parallel Provisioning
04/06/16 Mayank Gaikwad
04/06/16 Mayank Gaikwad
• with_chef_server "https://console.chef.io/organizations/mgdevstack",
:client_name => Chef::Config[:node_name],
:signing_key_filename => Chef::Config[:client_key]
• with_machine_options({
convergence_options: {
:ssl_verify_mode => :verify_none
},
bootstrap_options: {
image_id: "ami-08173648",
instance_type: "m1.small",
key_name: “mg-keypair", # If not specified, this will be used and generated
key_path: "/root/.ssh/mg-keypair.pem",
user_data: “~/chef/chef_user_data"
},
ssh_username: 'ec2-user',
security_groups: ["default"],
:transport_address_location => :private_ip,
:sudo => true
})
Secret Management
04/06/16 Mayank Gaikwad
• Data bags ( Bags to share data/secret across nodes )
• Encrypted Data bags ( Requires key management across nodes )
• Chef-Vault ( Provides 2 layer encryption decryption mechanism with
no hassle to manage keys across nodes )
Data Bags
Data Bag Creation:
Knife data bag create bag_name item_name
knife data bag from file bag_name path_to/item_name.json
Encrypting Data Bag
openssl rand -base64 512 | tr -d 'rn' > encrypted_data_bag_secret
knife data bag create bag_name item_name --secret
encrypted_data_bag_secret
{
/* This is a supported comment style */
// This style is also supported
"id": "ITEM_NAME",
"key": "value"
}
04/06/16 Mayank Gaikwad
Uses shared secret key to encrypt data.
Overhead of distributing keys and maintaining security during key share
04/06/16 Mayank Gaikwad
Client and Node’s public and private key store
04/06/16 Mayank Gaikwad
Chef-vault
When encrypted data created with chef-vault, it encrypts data-bag with
random shared secret key.
Generated Secret key then encrypted with user’s and nodes public key on
chef server.
So provides 2 layers of encryption.
With out managing secret key.
04/06/16 Mayank Gaikwad
Chef-Vault continued..
Installation
gem install chef-vault
Vault Creation
knife vault create credentials database -A mayank, meet -M client -S
‘name:poc-meetup*’ -J ./database.json
-A Users/ Nodes names
-M Mode for chef-vault
client -- if Chef-Server
solo -- if Chef-Solo
-S Node search parameter where vault can be decrypted
Vault Deletion:
knife data bag delete credentials
04/06/16 Mayank Gaikwad
Chef-Vault continued..
knife vault show credentials database
if user is admin.. Databag content will be shown else it will show
encrypted databag
Using vault within recipe
include_recipe ‘chef-vault’
vault = chef_vault_item(:credentials, ‘database’)
node.set[‘database’][‘password’] = vault[‘password’]
Edit Vault
knife vault edit credentials database
Delete item within vault
knife vault delete credentials database
04/06/16 Mayank Gaikwad
Vault Commands
Add Admin user
knife vault update credentials database -A “new-username”
Add new Node
knife vault update credentials database -S “search-query-for-nodes”
Updating users key
knife vault refresh credentials database
Removing user
knife vault remove credentials database -A “role:base”
04/06/16 Mayank Gaikwad
Test Driven Infrastructure
Convergence phases:
pre-convergence: syntax checking unit testing, lint checking
convergence:
post-convergence: verifies if node is in desired state(auditing)
Testing workflow
•Code Correctness - Foodcritic and Rubocop
•Unit Tests and testing - ChefSpec
•Integration Tests - Test Kitchen and ServerSpec
04/06/16 Mayank Gaikwad
Unit Testing
package "httpd" do
action :install
end
it "installs the httpd package" do
expect(chef_run).to install_package("httpd")
end
04/06/16 Mayank Gaikwad
Rubocop
Does Linting and convention check
Discover code style violation
Rubocop.yml
04/06/16 Mayank Gaikwad
Foodcritic
Checks cookbook for common problems
•Style
•Correctness
•Syntax
•Best practices
•Common mistakes
•Deprecations
Typically run against cookbook
Currently 61 rules to check linting, style guide and best practices
To exclude rule FC003:
foodcritic cookbooks/ --tags ~FC003
04/06/16 Mayank Gaikwad
04/06/16 Mayank Gaikwad
Foodcritic Rules
Foodcritic rules
 FC001 : accesses node attributes with
symbols
# Don't do this
package node[:cookbook][:package] do
action :install
End
package node['cookbook']['package'] do
action :install
end
FC004: Use a service resource to start and
stop services
# Don't do this
execute 'start-tomcat' do
command '/etc/init.d/tomcat6 start'
action :run
End
service 'tomcat' do
action :start
end
04/06/16 Mayank Gaikwad
Auditing cookbook
Cookbook/meetup/recipes/audit.rb
control_group 'Server Auditing:: ' do
control 'service' do
it 'should be stopped' do
expect(service('crond')).to_not be_running
end
end
end
04/06/16 Mayank Gaikwad
Questions & Answers
04/06/16 Mayank Gaikwad
Thanks You
04/06/16 Mayank Gaikwad

More Related Content

PDF
Overview of Chef - Fundamentals Webinar Series Part 1
PPTX
Chef fundamentals
PDF
Automating Infrastructure with Chef
PDF
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
PDF
Node setup, resource, and recipes - Fundamentals Webinar Series Part 2
PDF
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
PDF
Chef Fundamentals Training Series Module 1: Overview of Chef
PDF
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Overview of Chef - Fundamentals Webinar Series Part 1
Chef fundamentals
Automating Infrastructure with Chef
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Node setup, resource, and recipes - Fundamentals Webinar Series Part 2
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...

What's hot (20)

PDF
Node object and roles - Fundamentals Webinar Series Part 3
PDF
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
PDF
Chef-Zero & Local Mode
PDF
Chef Fundamentals Training Series Module 2: Workstation Setup
PPT
Overview of chef ( Infrastructure as a Code )
PDF
Automating your infrastructure with Chef
PDF
Environments - Fundamentals Webinar Series Week 5
PPTX
Chef introduction
PPTX
Opscode Webinar: Managing Your VMware Infrastructure with Chef
PPTX
Chef Tutorial for DEVOPS Newbies
PDF
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
PPTX
Introduction to chef
PDF
Introduction to Chef - April 22 2015
PDF
Introduction to Chef - Techsuperwomen Summit
PDF
Chef ignited a DevOps revolution – BK Box
ODP
Introduction to Chef
PPT
Chef, Devops, and You
PDF
Common configuration with Data Bags - Fundamentals Webinar Series Part 4
PDF
Infrastructure Automation with Chef
PDF
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Node object and roles - Fundamentals Webinar Series Part 3
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef-Zero & Local Mode
Chef Fundamentals Training Series Module 2: Workstation Setup
Overview of chef ( Infrastructure as a Code )
Automating your infrastructure with Chef
Environments - Fundamentals Webinar Series Week 5
Chef introduction
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Chef Tutorial for DEVOPS Newbies
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Introduction to chef
Introduction to Chef - April 22 2015
Introduction to Chef - Techsuperwomen Summit
Chef ignited a DevOps revolution – BK Box
Introduction to Chef
Chef, Devops, and You
Common configuration with Data Bags - Fundamentals Webinar Series Part 4
Infrastructure Automation with Chef
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Ad

Similar to Orchestration with Chef (20)

PDF
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
ODP
DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...
PPTX
SQL Server 2014 Backup to Azure - SQL Saturday CR 2015
PDF
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
PDF
Monitoring infrastructure with prometheus
PPTX
Building microservices sample application
PDF
An introduction to Apache Hive CI and QA
PPTX
Iac d.damyanov 4.pptx
PPTX
DevOps hackathon Session 2: Basics of Chef
PPTX
Building a scalable web application by combining modern front-end stuff and A...
PDF
20130528 solution linux_frousseau_nopain_webdev
PDF
Configuring a more secure BOSH
PPTX
[2019.1] 하이퍼레저 패브릭 v1.3, v1.4 새로운 기능
PDF
Behavior Driven Development and Automation Testing Using Cucumber
PPTX
Simple blog wall creation on Java
KEY
Chef 0.8, Knife and Amazon EC2
PDF
Session 3 - CloudStack Test Automation and CI
PDF
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
PDF
Chef Provisioning a Chef Server Cluster - ChefConf 2015
PDF
Building and deploying React applications
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...
SQL Server 2014 Backup to Azure - SQL Saturday CR 2015
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
Monitoring infrastructure with prometheus
Building microservices sample application
An introduction to Apache Hive CI and QA
Iac d.damyanov 4.pptx
DevOps hackathon Session 2: Basics of Chef
Building a scalable web application by combining modern front-end stuff and A...
20130528 solution linux_frousseau_nopain_webdev
Configuring a more secure BOSH
[2019.1] 하이퍼레저 패브릭 v1.3, v1.4 새로운 기능
Behavior Driven Development and Automation Testing Using Cucumber
Simple blog wall creation on Java
Chef 0.8, Knife and Amazon EC2
Session 3 - CloudStack Test Automation and CI
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Building and deploying React applications
Ad

Recently uploaded (20)

PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Essential Infomation Tech presentation.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
System and Network Administration Chapter 2
PPTX
Introduction to Artificial Intelligence
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
ai tools demonstartion for schools and inter college
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Nekopoi APK 2025 free lastest update
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
PTS Company Brochure 2025 (1).pdf.......
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Softaken Excel to vCard Converter Software.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Essential Infomation Tech presentation.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Reimagine Home Health with the Power of Agentic AI​
Design an Analysis of Algorithms II-SECS-1021-03
System and Network Administration Chapter 2
Introduction to Artificial Intelligence
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
ai tools demonstartion for schools and inter college
VVF-Customer-Presentation2025-Ver1.9.pptx
Nekopoi APK 2025 free lastest update
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PTS Company Brochure 2025 (1).pdf.......

Orchestration with Chef

  • 1. DevOps Orchestration with Chef Presented By: Mayank Gaikwad 04/06/16 Mayank Gaikwad
  • 2. Agenda 04/06/16 Mayank Gaikwad • Chef Provisioner • Secret Management • Cookbook Versioning • Dependency Management • Test Driven Infrastructure
  • 3. Chef Provisioning “ Allows to manage infrastructure with repeatable resource creation/deletion on different environment from dev, QA to production in very abstract and easy way” This is next step forward , Chef as configuration management tool What can be achieved- Idempotency Cluster Management Parallel Provisioning 04/06/16 Mayank Gaikwad
  • 4. 04/06/16 Mayank Gaikwad • with_chef_server "https://console.chef.io/organizations/mgdevstack", :client_name => Chef::Config[:node_name], :signing_key_filename => Chef::Config[:client_key] • with_machine_options({ convergence_options: { :ssl_verify_mode => :verify_none }, bootstrap_options: { image_id: "ami-08173648", instance_type: "m1.small", key_name: “mg-keypair", # If not specified, this will be used and generated key_path: "/root/.ssh/mg-keypair.pem", user_data: “~/chef/chef_user_data" }, ssh_username: 'ec2-user', security_groups: ["default"], :transport_address_location => :private_ip, :sudo => true })
  • 5. Secret Management 04/06/16 Mayank Gaikwad • Data bags ( Bags to share data/secret across nodes ) • Encrypted Data bags ( Requires key management across nodes ) • Chef-Vault ( Provides 2 layer encryption decryption mechanism with no hassle to manage keys across nodes )
  • 6. Data Bags Data Bag Creation: Knife data bag create bag_name item_name knife data bag from file bag_name path_to/item_name.json Encrypting Data Bag openssl rand -base64 512 | tr -d 'rn' > encrypted_data_bag_secret knife data bag create bag_name item_name --secret encrypted_data_bag_secret { /* This is a supported comment style */ // This style is also supported "id": "ITEM_NAME", "key": "value" } 04/06/16 Mayank Gaikwad
  • 7. Uses shared secret key to encrypt data. Overhead of distributing keys and maintaining security during key share 04/06/16 Mayank Gaikwad
  • 8. Client and Node’s public and private key store 04/06/16 Mayank Gaikwad
  • 9. Chef-vault When encrypted data created with chef-vault, it encrypts data-bag with random shared secret key. Generated Secret key then encrypted with user’s and nodes public key on chef server. So provides 2 layers of encryption. With out managing secret key. 04/06/16 Mayank Gaikwad
  • 10. Chef-Vault continued.. Installation gem install chef-vault Vault Creation knife vault create credentials database -A mayank, meet -M client -S ‘name:poc-meetup*’ -J ./database.json -A Users/ Nodes names -M Mode for chef-vault client -- if Chef-Server solo -- if Chef-Solo -S Node search parameter where vault can be decrypted Vault Deletion: knife data bag delete credentials 04/06/16 Mayank Gaikwad
  • 11. Chef-Vault continued.. knife vault show credentials database if user is admin.. Databag content will be shown else it will show encrypted databag Using vault within recipe include_recipe ‘chef-vault’ vault = chef_vault_item(:credentials, ‘database’) node.set[‘database’][‘password’] = vault[‘password’] Edit Vault knife vault edit credentials database Delete item within vault knife vault delete credentials database 04/06/16 Mayank Gaikwad
  • 12. Vault Commands Add Admin user knife vault update credentials database -A “new-username” Add new Node knife vault update credentials database -S “search-query-for-nodes” Updating users key knife vault refresh credentials database Removing user knife vault remove credentials database -A “role:base” 04/06/16 Mayank Gaikwad
  • 13. Test Driven Infrastructure Convergence phases: pre-convergence: syntax checking unit testing, lint checking convergence: post-convergence: verifies if node is in desired state(auditing) Testing workflow •Code Correctness - Foodcritic and Rubocop •Unit Tests and testing - ChefSpec •Integration Tests - Test Kitchen and ServerSpec 04/06/16 Mayank Gaikwad
  • 14. Unit Testing package "httpd" do action :install end it "installs the httpd package" do expect(chef_run).to install_package("httpd") end 04/06/16 Mayank Gaikwad
  • 15. Rubocop Does Linting and convention check Discover code style violation Rubocop.yml 04/06/16 Mayank Gaikwad
  • 16. Foodcritic Checks cookbook for common problems •Style •Correctness •Syntax •Best practices •Common mistakes •Deprecations Typically run against cookbook Currently 61 rules to check linting, style guide and best practices To exclude rule FC003: foodcritic cookbooks/ --tags ~FC003 04/06/16 Mayank Gaikwad
  • 18. Foodcritic rules  FC001 : accesses node attributes with symbols # Don't do this package node[:cookbook][:package] do action :install End package node['cookbook']['package'] do action :install end FC004: Use a service resource to start and stop services # Don't do this execute 'start-tomcat' do command '/etc/init.d/tomcat6 start' action :run End service 'tomcat' do action :start end 04/06/16 Mayank Gaikwad
  • 19. Auditing cookbook Cookbook/meetup/recipes/audit.rb control_group 'Server Auditing:: ' do control 'service' do it 'should be stopped' do expect(service('crond')).to_not be_running end end end 04/06/16 Mayank Gaikwad

Editor's Notes

  • #14: Stretegy: Use of Linting tools to adhere conventions provides uniformity, portability Use of Testing tools to verify cookbook is accomplishing intended goals