initcron-devops / razor

Razor Bare Metal Provisioner Setup with Ansible and Vagrant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RAZOR server setup using ansible

Edit Vagrantfile according your requirement. If not modified, the playbook will also work.

To create and config the infra.

Run the vagrant up from command line.

	vagrant up 

This will download the centos-6.7 box from from github and will install ansible and run playbook on it.

Razor setup

To create repo, Log in to razor server created earlier and download the ISO file of the OS.

E.g.

	vagrant ssh
	sudo su - razor
	wget http://centosmirror.go4hosting.in/centos/6.7/isos/x86_64/CentOS-6.7-x86_64-minimal.iso 
 	razor create-repo --name=centos-6.7  --iso-url file:///var/lib/razor/CentOS-6.7-x86_64-minimal.iso --task centos 
 	wget http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso 
 	razor create-repo --name=ubuntu-14.04 --iso-url file:///var/lib/razor/ubuntu-14.04.3-server-amd64.iso --task ubuntu/trusty

To view the repos

	razor repos

To Create Broker

Execute the following command on razor server.

	razor create-broker --name=noop --broker-type=noop

To view broker

	razor brokers

To Create Tag

	razor create-tag --name micro --rule '["<", ["num", ["fact", "memorysize_mb"]], 1000]'

	razor create-tag --name small  --rule '[">", ["num", ["fact", "memorysize_mb"]], 1000]'

This will create two tags "small" and "micro"

To view tags

	razor tags

To creata a policy that will load centos for small VMs

create a file with name centos-small.json" and contents

{
  "name": "centos-for-small",
  "repo": "centos-6.7",
  "task": "centos",
  "broker": "noop",
  "enabled": true,
  "hostname": "host${id}.initcron.com",
  "root_password": "AbhI",
  "max_count": 100,
  "tags": ["small"]
}

and file named ubuntu-micro.json

	{
  "name": "ubuntu-for-micro",
  "repo": "ubuntu-14.04",
  "task": "ubuntu/trusty",
  "broker": "noop",
  "enabled": true,
  "hostname": "host${id}.initcron.com",
  "root_password": "AbhI",
  "max_count": 100,
  "tags": ["micro"]
}

Now execute cmd

	razor create-policy --json ubuntu-micro.json

	razor create-policy --json  centos-small.json

To view polices

 
	razor policies

###To test the setup

create a VM in virtual box

  • Click New

  • Click Continue and change the memnory to 1200

  • Click Continue, then Create, then Continue, then Continue, then Create

    this will create you VM

  • Now modify the VM to allow network boot

    Click on newly created VM and the Settings, click on System and do the changes like the following

  • Now modify VM to get launched on the same net as razor server i.e private network

    click on Network and do the changes as

Click OK

  • To start VM, click Start

    you will see a screen,

click cancel

  • Now you should see something like this.

This verify that your VM is booting from Network. The GateWay IP in your case will will same as private network IP of razorserver in VagrantFile

  • Now you will see that micro-kernel is getting loaded into VM.

  • Next you will this screen, that verifies that the micro-kernel is loaded.

  • Now razor will load the new OS on your VM depending on your policy.

About

Razor Bare Metal Provisioner Setup with Ansible and Vagrant