Sha256: 80aed91377ea2b71f0d2843b25e5cc6c787f7140ff00b8820fbdbc5a4de0d4a8

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

namespace :bootdisk do
  namespace :generate do
    desc 'Generate a static boot disk for a specific host.  NAME=fqdn, TYPE=iso (default) or usb, OUTPUT path'
    task :host => :environment do
      host = Host::Base.find_by_name(ENV['NAME']) || raise("cannot find host '#{ENV['NAME']}', specify NAME=fqdn")
      tmpl = host.bootdisk_template_render

      type = (ENV['TYPE'] || 'iso').downcase
      case type
        when 'usb'; Bootdisk::USBGenerator
        else; Bootdisk::ISOGenerator
      end.new(tmpl).generate do |image|
        output = ENV['OUTPUT'] || "#{host.name}.#{type}"
        FileUtils.cp image, output
        puts "Wrote #{output}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_bootdisk-1.0.0 lib/tasks/bootdisk.rake