iaas with chef
TRANSCRIPT
Build Cloud Computing
Infrastructure with Chef and VagrantInfrastructure with Chef and Vagrant
General Discussion
Richard Kuo, Professional-Technical Architect,Cloud Realization, New Technology Product Development Engineering
Outline
• Infrastructure As Code
• Configuration Tools
• Cookbook Structure
• Local Cloud and Remote Cloud• Local Cloud and Remote Cloud
• Sample Code
• References
6/21/12 Creative Common BY-NC-SA 2
Infrastructure As Code
• Modularized, reusable document
• Change control
• Reflect the change of business environment
• Programmatically provisioning & configuration• Programmatically provisioning & configuration
6/21/12 Creative Common BY-NC-SA 3
Nodes Are Weaved(from chef video)
6/21/12 Creative Common BY-NC-SA 4
Why Configuration Tools
• Automation
• Reduce management complexity
• Version control programs
• Generate configuration• Generate configuration
• Maintain the state of resources
6/21/12 Creative Common BY-NC-SA 5
Work Flow
• Install version control - git; https://github.com/
• Install RVM then Ruby;
• Install RubyGems;
• Register an Hosted-Chef Platform account, and download credentials and default configuration file: knife.rb; (optional-local chef-solo)
• Register account on cloud provider and download the credentials.
• Install configuration tool - Chef; http://wiki.opscode.com/display/chef/Installation
• Move credentials .chef directory and modify knife.rb; and test connectivity to chef-server;
• Setup client-configuation, by executing “knife configure client ./client-config”, and check it diff • Setup client-configuation, by executing “knife configure client ./client-config”, and check it diff between ORGNAME-validator.pem and validation.pem; make a copy to /etc/chef/; copy ORGNAME-validator.pem to ~/.ssh/validation.pem;
• Install knife plugins for different cloud providers, i.e. knife-ec2, knife-rackspace, etc;
• Install Vagrant;
• Create a workspace by cloning chef-repo; go under chef-repo, create .chef directory; git init with github;
• Download/clone cookbooks, modify recipes;
• Upload cookbooks to (Hosted-)Chef Server;
• Test recipe locally with Vagrant;
• Create node per image #; bootstrap node and create infrastructure.
6/21/12 Creative Common BY-NC-SA 6
Install Chef with Hosted-Chef Server
6/21/12 Creative Common BY-NC-SA 7
Knife Configuration
6/21/12 Creative Common BY-NC-SA 8
Cookbooks Repositories http://community.opscode.com/
6/21/12 Creative Common BY-NC-SA 9
Chef Conceptual UML(work in Progress)
6/21/12 Creative Common BY-NC-SA 10
Cookbook/Recipe
Structure
6/21/12 Creative Common BY-NC-SA 11
Vagrant Recipe
6/21/12 Creative Common BY-NC-SA 12
Create a Server in EC2
knife ec2 server create \ #use knife-ec2 to create a server
- r “role[webserver]” \ #use recipe in role “webserver”
- i ami-2d4aa444 –flavor m1.small \ #use image and settings here
- g TestChef, default \ #use security group defined in ec2
- x ubuntu \ #user name is ubuntu
- n server01 \ #server name is server01 - n server01 \ #server name is server01
6/21/12 Creative Common BY-NC-SA 13
Demo
6/21/12 Creative Common BY-NC-SA 14
Thank You for Listening.
6/21/12 Creative Common BY-NC-SA 15
6/21/12 Creative Common BY-NC-SA 16
6/21/12 Creative Common BY-NC-SA 17
Role of Configuration Tools in IaaS
6/21/12 Creative Common BY-NC-SA 18