Easy mass-production of fine-tuned vmware/virtualbox VMs.
'seisan' == 'production'.to_japanese; therefore 'seisan-line' == 'production-line'.to_japanese
Components of seisan-line = veewee + origami (+ puppet, eventually):
- veewee = creates Fusion box based on
definition.rb
and kickstart file--ks.cfg
. - origami = creates
definition.rb
andks.cfg
. - (puppet = manages veewee and origami && send products to the right places)
Note (As of Aug 22nd, 2012): EL 5 and 6, Debian 6, Ubuntu 10.04/12.04, and SLES 11 are supported.
Dependencies:
- VMFusion
- ruby >= 1.8.7
- fission (for stopping vm)
- rbvmomi (for marking the exported vm a template)
- other gems required by veewee
Procedure:
git clone git://github.com/akumano/seisan-line.git
cd seisan-line
git submodule init # 'origami' and 'veewee' are used as submodules
git submodule update # fetch repos as specified in .gitmodule
gem install fission rbvmomi
vim lib/seisan_config.rb # edit it
touch ~/.seisanrc.yml
vim ~/.seisanrc.yml # see example
# The lines below set up veewee.
cd veewee
gem install bundler
bundle install # This gets all necessary gems for veewee
cp seisan-line/veewee/fissionrc.example ~/.fissionrc # Then edit this file. Read comments.
mkdir seisan-line/veewee/iso # put your isoimages here
# change seisan-line/origami/definitions/seeds/iso_file.yml accordingly
# veewee is now ready to go.
# One next thing to do is setting up environment to create definition.rb and ks.cfg,
which 'origami' takes care of.
# Take a look at seisan-line/origami/lib/inventory/[kickstart|preseed|autoinst|definition]/seeds/*.yml and change installation options.
# The format is fairly straight forward. Read origami's documentation if you'd like.
# The end.
Example 1: Create CentOS-5-32-PE definition, inspect it, then build Fusion box.
-
Create definition for veewee:
seisan --name CentOS-5-32-PE --define
-
See
veewee/definitions/CentOS-5-32-PE/[definition.rb|ks.cfg]
-
Have veewee create the box w/ gui:
seisan --name CentOS-5-32-PE --build --gui
-
Veewee will spit out the box's ip address when it finishes building. A command to ssh into the box would be
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p <port> -l <user> <ip.address>
(By default, <user> = root, <passwd> = puppet)
Example 2: Build all Ubuntu boxes, send it to vSphere and templatize them
-
Create a file
ubuntu_names.txt
containing all Ubuntu names:Ubuntu-10-32-PE Ubuntu-10-32-FOSS Ubuntu-10-64-PE Ubuntu-10-64-FOSS Ubuntu-12-32-PE Ubuntu-12-32-FOSS Ubuntu-12-64-PE Ubuntu-12-64-FOSS
-
Have 'seisan-line' act on the file:
seisan --file ubuntu.txt --build --bootstrap --vsphere --templatize
For each box it will take just a moment to create definition, 5
10 minutes to build a rather bare-bone box, 0.51 hour to export it to vsphere and another instant for templatization.
Important:
SLES network interface name is not persistent. It often changes between eth0 and eth1.
I have even seen eth2 or 3. By default, seisan-line is robust
enough to support eth0~5 in anticipation of even more outrageous situations.
If ethN, where N>5, ever appears, go into origami/lib/inventory/autoinst/autoinst_base.erb
edit it to deal with the situation.
Find all locaitons in the config file where eth1 (or eth0) is mentioned,
and create corresponding entries for ethN.
Commands:
(I will use the term ks.cfg
as a generic configuration file for
unattended installation procedures such as 'anaconda', 'preseed'
and 'autoyast'.)
-
-d
,--define
,--bootstrap
:- Create a definition for veewee to work on.
- A definition directory, which contains
definition.rb
,ks.cfg
, and post-install scripsts, is created underveewee/definitions
. - In addition,
ks.cfg
anddefinition.rb
will be copied to the webserver you specified inseisan_config.rb
.
-
-b
,--build
:- Build a VM. A definition must exist prior to building.
Using the
--bootstrap
flag with the build flag will create a definition then start building a box. - Force option (
--force
): force creation of VM even if a VM of the same name exists (i.e. destroy the pre-existing one). - GUI option (
-g
or--gui
): launch up VMFusion GUI while installation - (Not implemented yet) VirtualBox option (
--vbox
): make a small change indefinition.rb
to tell veewee to build a VM with virtualbox.
- Build a VM. A definition must exist prior to building.
Using the
-
--vsphere
:- Export a VM to vSphere.
lib/seisan_config.rb
needs to be edited.
- Export a VM to vSphere.
-
--templatize
:- Mark a VM in vSphere as a template.
lib/seisan_config.rb
needs to be edited to use this flag, as well.
- Mark a VM in vSphere as a template.
-
--destroy
:- Destroy an existing VM.
-
--list
:- List boxes that are ready to be built.
NAME format:
NAME
must meet the following format: <distro>-<version>-<arch>-<type>
, where the ones supported by default are:
distro
-- CentOS, RedHat, SL, Oracle, Ubuntu, Debian, SLESversion
-- (EL) 5, 6 ; (Ubuntu) 10, 12 ; (Debian) 6 ; (SLES) 11arch
-- 32, 64type
-- PE, FOSS
Take a look at origami/lib/inventory/[kickstart,preseed,autoinst,definition]/seeds/*.yml
and change installation options. The format is fairly straight forward.
For example,
# pkgs.yml
---
Oracle:
'5':
PE:
- openssh-server
FOSS:
- openssh-server
- ruby
'6':
PE:
- openssh-server
- git
FOSS:
- openssh-server
- git
- ruby
means Oracle-5-<whatever arch>-PE
will be built with openssh-server
installed,
Oracle-6-<whatever>-FOSS
will be built with openssh-server
, git
and ruby
installed, and so on.
Read origami's documentation if you'd like > http://github.com/akumano/origami
Note that you can only change the following options by modifying yaml files:
pkgs
, kickstart_file
, iso_file
, os_type_id
, iso_file
, boot_cmd_sequence
, postinstall_files
, and reponame
.
Other options are shared among all installations.
To change those options, see 'HowTo: Change pre-defined installation options'
The only way to do this currently is to manually a new key-value pairs in each origami/lib/origami/inventory/[kickstart|definition]/seeds/*.yml
file.
A more convenient method to modify the yaml files is coming up soon.
Also, the directory structure must comply to the naming scheme in use, and
they are not automatically generated. Hence if you wish to create
a new type you need to create new directories under definitions
(not veewee/definitions
).
For example, here's the directory tree of my default.
If your new OS uses kickstart, preseed or autoyast, procedures to adding the OS is identical to adding a new type (see the previous entry).
Otherwise, create a new directory under origami/lib/origami/inventory
, and copy structures of other inventories.
For example, inventory/kickstart
has this structure.
definition_base.erb
is a master template for definition.rb
with some parameters extracted.
These parameters are what you create yaml files for. Place the yaml files in seeds/
directory.
Then configure origami to read your new inventory. This is done across codes under lib/origami/core/
.
These options are defined in *_base.erb
files under origami/lib/origami/inventory/*/
.
Use --vbox
flag with either --define
or --bootstrap
. This will change the disk_format
in definiton.rb
from 'VMDK' to 'VDI'. Alternatively, you should change the option in definition_base.erb
if you use VirtualBox primarily.
- Read inventory automatically
--vbox
flag- An abstraction layer over seed yaml files
e.g.seisan --config CentOS-*-*-FOSS --param pkgs --val [openssh-server, ntp, vim, emacs, ruby]
changes hash values of keys that matchCentOS-*-*-FOSS
inpkgs.yml
to[openssh-server, ntp, vim, emacs, ruby]
.