Giter VIP home page Giter VIP logo

cookbook-ii-usb's Introduction

Description

This cookboks aims to create bootable USB sticks that contain OS vendor ISO. These ISO's are booted for fully automated installs via seedfiles (Debian/Ubuntu) and Autounattended.xml (Windows). Chef-client is installed at all possible injection points, allowing for chef-driven hardware installs.

Currenty Ubuntu 12.04.1 is supported, but Windows and OSX are foreseeable targets.

Requirements

  • Ubuntu 12.04 host
  • Fast USB stick you don't mind formatting.

Attributes

node['ii-usb']['target-device']

This should be set to '/dev/sdX' which is the block device of your USB. Some checking is done to try not and fry anything that isn't a usb stick, however you should note that this may accidentally format your entire drive.

node['ii-usb']['src-chef-repo']

the path of the chef-repo you want rsynced onto the usb. Eventually this will be a git resource.

node['ii-usb']['target-solo-config'] = 'target-solo.rb'

chef-solo config file for chef run on target

Usage

Currently ii-usb::create-usb-solo is the main recipe.

I often use a create-usb-chef-solo.rb that looks like this:

current_dir = ::File.dirname(::File.absolute_path(__FILE__))
cookbook_path "#{current_dir}/cookbooks" #, "#{current_dir}/site-cookbooks"

solo_json_file = "#{current_dir}/.chef/create-usb-solo.json"
open(solo_json_file,'w+') do |f|
  f.write(
    {
      "run_list" => [
        "recipe[ii-usb::create-usb-solo]"
        ],
      'ii-usb' => {
        'src-chef-repo' => current_dir, # for now we'll just copy ourselves
        'target-device' => ENV['TARGETUSB'] # We do this to force setting it at runtime
      }
    }.to_json
    )
end
json_attribs solo_json_file

cache_type               'BasicFile'
cache_options( :path => "#{current_dir}/.chef/checksums")
file_cache_path "#{current_dir}/../cache"
file_backup_path "#{current_dir}/.chef/backup"
role_path "#{current_dir}/roles"
verbose_logging false

Then run:

sudo TARGETUSB=/dev/sdc chef-solo -c ./create-usb-solo.rb
sudo umount /media/ii-usb*/ # ubuntu likes to automount....
sudo umount /tmp/ii-usb-target/ # the default mountpoint, so I can put it into my test computer

cookbook-ii-usb's People

Contributors

hh avatar

Stargazers

 avatar Michael B. Sumulong avatar dn365 avatar

Watchers

dn365 avatar James Cloos avatar  avatar  avatar

Forkers

huhongbo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.