iaas with chef

18
Build Cloud Computing Infrastructure with Chef and Vagrant General Discussion Richard Kuo, Professional-Technical Architect, Cloud Realization, New Technology Product Development Engineering

Upload: richard-kuo

Post on 07-Aug-2015

82 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: IaaS with Chef

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

Page 2: IaaS with Chef

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

Page 3: IaaS with Chef

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

Page 4: IaaS with Chef

Nodes Are Weaved(from chef video)

6/21/12 Creative Common BY-NC-SA 4

Page 5: IaaS with Chef

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

Page 6: IaaS with Chef

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

Page 7: IaaS with Chef

Install Chef with Hosted-Chef Server

6/21/12 Creative Common BY-NC-SA 7

Page 8: IaaS with Chef

Knife Configuration

6/21/12 Creative Common BY-NC-SA 8

Page 9: IaaS with Chef

Cookbooks Repositories http://community.opscode.com/

6/21/12 Creative Common BY-NC-SA 9

Page 10: IaaS with Chef

Chef Conceptual UML(work in Progress)

6/21/12 Creative Common BY-NC-SA 10

Page 11: IaaS with Chef

Cookbook/Recipe

Structure

6/21/12 Creative Common BY-NC-SA 11

Page 12: IaaS with Chef

Vagrant Recipe

6/21/12 Creative Common BY-NC-SA 12

Page 13: IaaS with Chef

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

Page 14: IaaS with Chef

Demo

6/21/12 Creative Common BY-NC-SA 14

Page 15: IaaS with Chef

Thank You for Listening.

6/21/12 Creative Common BY-NC-SA 15

Page 16: IaaS with Chef

6/21/12 Creative Common BY-NC-SA 16

Page 17: IaaS with Chef

6/21/12 Creative Common BY-NC-SA 17

Page 18: IaaS with Chef

Role of Configuration Tools in IaaS

6/21/12 Creative Common BY-NC-SA 18