San Antonio Chef Users
June 2014SAChefUsers
Hart Hoover / Josh O'Brien
@SAChefUsers
@hhoover @OBrienCommaJosh
What does Chef Metal do?
Provides a 'machine' resource
Allows cluster management in Chef
VERSION CONTROL
Driver Driven Development
SSH: Bare Metal
chef-metal-fog: Cloud
Vagrant: Testing VMs
LXC / Docker: Containers
vSphere: VMWare
Driver Driven Development
SSH: Bare Metal
chef-metal-fog: Cloud
Vagrant: Testing VMs
LXC / Docker: Containers
vSphere: VMWare
More Advanced Chef Metalmachine 'db' do recipe 'apt' recipe 'mysql' recipe 'application_cookbook::db_master' tag 'dbmaster' notifies 'converge', 'machine[web]', 'delayed'end
machine 'web' do recipe 'apt' recipe 'apache' recipe 'application_cookbook::webapp' tag 'webserver' attributes( rackspace: { cloud_credentials: { username: Chef::Config[:rackspace_api_username], api_key: Chef::Config[:rackspace_api_key] } } ) action 'nothing'end
Batch Modemachine_batch do machine 'db' do recipe 'mysql' end
machine 'web1' do recipe 'apache' endend
Cloud Recipe Walkthroughnode.set['build-essential']['compile_time'] = trueinclude_recipe 'build-essential'
chef_gem 'chef-metal' do version '0.12.1' action 'install'end
chef_gem 'chef-metal-fog' do version '0.6.1' action 'install'end
require 'chef_metal'require 'chef_metal_fog'require 'cheffish'require 'fog'
Cloud Recipe Walkthroughwith_driver 'fog:Rackspace:https://identity.api.rackspacecloud.com/v2.0', compute_options: { rackspace_api_key: Chef::Config[:rackspace_api_key], rackspace_username: Chef::Config[:rackspace_api_username], rackspace_region: Chef::Config[:rackspace_region] }
fog_key_pair metal-key
with_machine_options ssh_username: 'root', bootstrap_options: { key_name: metal-key, flavor_id: 'performance1-2', image_id: 'ffa476b1-9b14-46bd-99a8-862d1d94eb7a' }
Cloud Recipe Walkthrough# Read Chef Config from knife.rbwith_chef_server Chef::Config[:chef_server_url], client_name: Chef::Config[:node_name], signing_key_filename: Chef::Config[:client_key]