Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automating the Cloud (Unix)

Avatar for Mat Schaffer Mat Schaffer
October 27, 2012
200

Automating the Cloud (Unix)

Avatar for Mat Schaffer

Mat Schaffer

October 27, 2012
Tweet

Transcript

  1. Our agenda • Me • You • Old cars •

    How Chef works • Setting up Chef • An Example deployment
  2. You

  3. “... continuous delivery will move from being a competitive advantage

    to being a prerequisite for survival.” - Jez Humble
  4. (Chef server) b my_cookbook $ chef-client $ chef-client my_cookbook my_cookbook

    $ chef-server my_cookbook ├── README.rdoc ├── attributes ├── definitions ├── files │ └── default ├── libraries ├── metadata.rb ├── providers ├── recipes │ └── default.rb ├── resources └── templates └── default
  5. Cookbook: mysql default['mysql']['memory'] = "32M" Role: db default_attributes 'mysql' =>

    { 'memory' = "2G" } Environment: dev "mysql" : { "memory": "1G" } Node: db3.dev.mashion.net "mysql" : { "memory": "512M" }
  6. 39 service 'nginx' do 40 action :start 41 end Recipes

    1 default['nginx']['version'] = "1.2.3" 2 default['nginx']['dir'] = "/etc/nginx" Attributes 2 DAEMON=<%= @src_binary %> 3 NAME=nginx 4 DESC=nginx 5 PID=<%= @pid %> Templates
  7. git clone https://github.../matschaffer/cposc-cloud cd cposc-cloud gem install berkshelf berks install

    berks upload knife role from file roles/* # store cposc-cloud.pem to ./
  8. gem install knife-ec2 # in ~/.chef/knife.rb knife[:aws_access_key_id] = "AKI..." knife[:aws_secret_access_key]

    = "wmw..." knife[:availability_zone] = "us-east-1d" knife[:image] = "ami-8fac75e6" knife[:aws_ssh_key_id] = "cposc-cloud" knife ec2 server create -x ubuntu -i cposc-cloud.pem \ -r 'recipe[cposc-cloud]' github.com/opscode/knife-ec2
  9. Wrap-UP • Automation can save your business • CM is

    a key part of your automation stack • You can get started today