new to chef and puppet ? overview of chef and puppet and how they can automate infrastructure and...
TRANSCRIPT
Kundana PalagiriProgram Manager, Azure Compute
Leverage Existing Chef / Puppet Toolsets for Management
Learn about Chef and Puppet Integration.General workflow for VM customization on Azure.
VM Customization on Azure
What will we learn?• New to Chef and Puppet ? Overview of Chef and Puppet and how they can automate infrastructure and application deployment on Azure.
• Existing Chef/Puppet Users? Learn about extending Chef & Puppet to Azure.
• Other automated VM customization options?
Learn about VM customization using standard scripts.
What will we not cover?• Mastering Chef/Puppet DSL.• Writing cookbooks/modules.• Azure IaaS components.• DevOps workflows and tooling.
VM Customization Workflow
Provision/ Manage
Infrastructure
Bootstrap Agents
Customize VM
Software provided both Microsoft or by trusted third-party providers for Azure VMs to extend the functionality of the VM.
Windows and Linux support. Deploy to a running or a new VM. Programmability support. Update life cycle that’s independent of the VM.Enables dynamic composition on a VM.
VM Extensions : Building block for Devops
Demo : VM Extensions from Portal
1. Custom Scripts for VM Customization
Author the scripts
Upload them to Azure
Storage or GitHub
Deploy them to a remote VM – New or
running
Workflow
Scripting Languages Supported:Linux : Ruby, Python,, Bash, perlWindows : PowerShell, DSC
CLI Supported:Azure CLI or Azure Powershell
Demo Custom Script for Linux using Azure CLI
Custom Script Capabilities
Bootstrap any agent and execute scripts that install software or configure resources on the VM.
What is Chef? Chef is a configuration management tools for deploying & managing infrastructure and applications.
- Infrastructure is code- Declarative interface to resource- Policy based configuration management.
2. Chef on Azure
Chef Concepts:Knife : Cmdline tool to manage infrastructure and bootstrap chef.
Resource : Fundamental building block, piece of a system.
Recipe : ‘code’ for managing the resource.
Cookbook : Collection of recipes.
Runlist : A policy which needs to be applied on the node.
Click icon to add picture
Managing Azure VMs using Knife
Bootstrapping chef agent using Chef
Extension
Leveraging DSC resources using
Chef
Chef Options for Azure
Chef Server Account: Sign up for Hosted Chef account : https://manage.opscode.com/signup
Setting up Chef Workstation: Download the starter kit from Chef server. Setup the workstation by downloading the chef-client :
https://www.getchef.com/download-chef-client/ Install knife azure : gem install knife-azure
The workstation is now ready to manage VMs in Azure!
Managing Infrastructure in Azure using Knife
Create a VM : Download publish settings file from here : https://manage.windowsazure.com/publishsettings/index?client=powershell
Knife azure image list --azure-publish-settings-file '/path/to/your/cert.publishsettingsfile'knife azure server create--azure-publish-settings-file '/path/to/your/cert.publishsettingsfile'--azure-dns-name 'myservice'--azure-source-image 'windows-image-name'--ssh-user ‘testuser'--ssh-password ‘azuredemo'--azure-service-location "West US"
Managing Infrastructure in Azure using Knife
Demo :
Bootstrapping chef agent on Azure
Azure Powershell :
Set-AzureVMChefExtension-VM <IPersistentVM> -ValidationPem <Validator.pem> -ClientRb <Client.rb> -RunList <RunList>
Knife Command:
knife azure server create --azure-dns-name 'knifetest2' --bootstrap-protocol 'cloud-api‘ --azure-source-image '3422a428aaf14529884165693cbb90d3__DreamFactory_1.7.8-0_-_Ubuntu_14.04' --azure-service-location 'West US' --ssh-user 'kundanap' --ssh-password 'Azuredemo4'
CLI tools for automating Chef Extension installation
Ready to go!Your existing Chef toolkit is now ready to manage resources on Azure
Resources for learning about Chef:https://learn.chef.io/
Windows Azure for Chef:https://www.chef.io/partners/microsoft/
Admins who manage a mix of both windows and linux deployments can leverage DSC using Chef.
Preview of DSC cookbook which exposes DSC resources as Chef resources is available : https://supermarket.getchef.com/cookbooks/dsc
All the DSC resources returned by get-dscresource can be managed by Chef using the cookbook.
Simple rules for transforming DSC resource into Chef resource published here : https://github.com/opscode-cookbooks/dsc/blob/master/README.md
Chef + DSC
What is Puppet? : Puppet is a configuration management system that allows you to define the state of your IT infrastructure, then automatically enforces the correct state.
Key Concepts:- Supports easy to read declarative language.- Enforces desired state on the system.- Puppet Forge supports many ready to use modules.
- .
3. Puppet on Azure
What is Chef? Chef is a configuration management Manifest : A file containing code written in the Puppet language,& managing infrastructure and applications. Manifest contains resources and classes.
Resources : A unit of configuration, whose state can be managed by Puppet.
Module : A collection of classes, resource types, files, and templates, organized around a particular purpose.
Catalog : A catalog is a document that describes the desired system state for one specific computer. Catalogs are compiled from manifests by a puppet master server and served to agent nodes.
- Infrastructure is code- Declarative interface to resource- Policy based configuration management.
Puppet Terminology
Provisioning using Puppet Azure
module
Bootstrapping puppet agent using Puppet Extension
Leveraging DSC resources using
Puppet
Puppet Options for Azure
Puppet Commands for Azure VM provisioning
Install a Puppet Azure Module
puppet module install msopentech-microsoftazure
puppet azure_vm create \ #> --management-certificate pem-or-pfx-file-path \--azure-subscription-id=your-subscription-id \--image b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-13_04-amd64-server-20130501-en-us-30GB \--location 'west us' \--vm-name vmname \--vm-user username \--password ComplexPassword \--puppet-master-ip yourPuppetMasterIPAddress
Demo :
Bootstrapping Puppet agent on Azure VMs.
Step1 : Setting up Puppet Master:
Select the Puppet Master Image from Azure Gallery . Note : Provide a lowercase cloud service & vm name for the Puppet Master.
Add the following end points on the Puppet Master VM:443 for HTTPS8140 for Puppet61613 for MCollective
Browse to the Puppet master VM and retrieve the user name and password for PE console:User login is located in the file /etc/puppetlabs/installer/answers.install (admin@<VM name>.cloudapp.net)
Password is located in the file /etc/puppetlabs/installer/database_info.install
Wait for 10 mins and login to PE console : https://<cloudservicename>.cloudapp.net
Install Puppet Master
Setting up Puppet agent from the Azure Portal
Select any windows VM, add Puppet extension with input : puppetmastername.cloudapp.net
Setting up Puppet Agent from Azure Powershell:
vm = get-AzureVM -ServiceName $svcName -Name $name Set-AzureVMPuppetExtension –PuppetMasterServer $puppetmaster –VM $vmUpdate-AzureVM -VM $vm.VM -ServiceName $svcName -Name $name
Install Puppet Agent
Ready to go!Your existing Puppet toolkit is now ready to manage resources on Azure
Resources for learning about Puppet:https://puppetlabs.com/ Puppet Resource Guide for Azure:http://puppetlabs.com/sites/default/files/Getting-Started-Guide-Puppet-Enterpise-Azure.pdf Managing DSC resources using Puppet: Community
module in Puppet Forge : https://forge.puppetlabs.com/msutter/dsc
Wrap up
Others tools that we should integrate with Azure?
Thank you!
© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.