dalang / razor-vagrant-demo

A demo of Razor using Vagrant.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

razor-vagrant-demo

TODO

Auto configurations failed

  1. NPM for node.js
  2. mime and express@2.5.11 packages of node.js (with --registry=registry.npm.taobao.org)
  3. set agent1 network to host-only type manually

Mongodb service cannot start

If it happens, razor will not work. This always caused by VM not been shutdown gracefully. Try the solution as follow.

  • ssh to VM
  • delete mongodb.lock file at /var/lib/mongodb/
  • restart mongodb service

Host OS is Windows

  • care line ending on Windows, it's recommended to run git config --global core.autocrlf false
  • puppet cannot work as a gem on windows, install puppet by windows installer instead.
  • librarian-puppet gem depends on puppet gem, so won't work under windows either.
  • Vagrant-wrapper not work proper on windows, use dalang's fork instead.
  • tftp service not running: service tftpd-hpa restart

A demo of Razor using Vagrant.

Demo

This is a demo using Vagrant of Puppet Lab's Razor introduction.

Step 1: Setup

First install VirtualBox and the VirtualBox Extension Pack. Next bundle & boot the servers:

$ bundle install
$ bundle exec rake start

The gold server will boot first and kick off a puppet run. This will install razor and setup dhcp on the internal VM network. Once the gold server finished the agent1 box will boot. agent1 initially fails to PXE boot because razor is not configured with a microkernel.

MicroKernel Missing

Step 2: Register a MicroKernel

$ bundle exec rake microkernel

The microkernel rake task downloads and registers the razor microkernel. At this point agent1 will boot the microkernel.

MicroKernel Console

The agent1 server will register itself with razor. We can inspect it via the razor node command.

$ bundle exec vagrant ssh gold
$ sudo su -
$ cd /opt/razor
$ bin/razor node

razor node

The razor node attributes command will show the attributes of agent1.

$ bin/razor node attributes ...

razor node attributes

Step 3: Register an OS

Run the ubuntu rake task to download and register Ubuntu Precise 12.04 Server with razor. This may take a while.

$ bundle exec rake ubuntu

List the registered OS images via razor image.

$ bundle exec vagrant ssh gold
$ sudo su -
$ cd /opt/razor
$ bin/razor image

razor image

Step 4: Create a Model

Add a model for ubuntu\_precise with the new image.

$ bin/razor model add template=ubuntu_precise label=install_precise image_uuid=...

razor model add

Step 5: Add a Policy

Create a policy to install ubuntu on agent1.

$ bin/razor policy add --template=linux_deploy --label=precise --broker-uuid=none --tags=virtualbox_vm --enabled --model-uuid=...

razor policy add

Step 6: Ubuntu

On the next checkin by agent1 the server will reboot. Instead of booting the microkernel, razor serves agent1 the Ubuntu installer.

Ubuntu Installer

Once that finishes you can login as root with your password.

Ubuntu Console

Step 7: Cleanup

Run vagrant destroy to cleanup everything.

$ bundle exec vagrant destroy --force

About

A demo of Razor using Vagrant.


Languages

Language:Ruby 84.5%Language:Puppet 14.9%Language:Shell 0.6%